Making Write Requests
Authentication
With the exception of the Authenticate and GetSystemInfo methods, all Octopus API methods require that a valid token be passed in the request. If no token is supplied, the request will fail with an error.
The authentication token must be passed as a header - "Authorization" with the specified type Bearer
. For example:
Authorization: Bearer {USER_ACCESS_TOKEN}
For more details, please check the Authentication section.
Request structure
Here is an example of an Update request to visualize possible parameters.
{
"AbEntry": {
"Data": {
"Key": "Q29tcGFueQkyNDA4MTMyNTIwMTMzNTMzNjAwNzhDCTA=",
"WebSite": "http://www.newsiteupdated.com"
}
},
"Compatibility": { // optional
}
}
The top-level object in most requests is the object name being passed in the request. In the example above, since this is an AbEntry read request, the entity that is passed is an AbEntry entity.
In the following sections, you will find more details.
Responses
Code
All Octopus API methods return an integer Code to indicate if the request was successful or if it failed.
A Code value of 0
indicates that the request was successful. A negative Code value indicates that an error occurred when processing the request.
Data
If the request is successful, all Octopus API methods return a Data object which contains the results of the request.
For entity methods, the Data object is nested inside the root-level entity object corresponding to the method being called.
The contents of the Data object vary depending on the method being used.
Msg
The Msg property, if present is an array of strings that contain additional informaiton about the request or the response.
For example, the Msg property may contain information about errors or request failures, or about the status of the API itself.
-
If the request fails for any reason, all Octopus API methods return a Msg array containing information about the error that has occurred to help with troubleshooting.\
-
If the entity or method that is called is still in a beta or testing release state, the Msg array will contain a message indicating that the method should not be used in a production environment.\
AbEntry update response example
{
"Code": 0,
"AbEntry": {
"Data": {
"Key": "Q29tcGFueQkyNDA4MTMyNTIwMTMzNTMzNjAwNzhDCTA=",
"Type": "Company",
"CompanyName": "E. Brown Enterprise"
}
}
}
Error example
{
"Code": -1,
"Msg": [
"The given key is of a type not supported by the target object.(DONOTUPDATE)"
]
}