API Response
All API methods with a few exceptions return a JSON "ResponseObject" in the following format:
{
"result": "...",
"error": {
"errorCode": "...",
"message": "..."
}
}
In general, if a GET method, or sometimes a POST method, is executed successfully, the "result" property will contain the data it retrieved. If a PUT or DELETE method is executed successfully, the "result" property will usually be an empty string.
If any API method failed during execution, the "result" property will be an empty string and the "error" property will contain an error code and an error message.
Following are a few common error codes:
- AUTHENTICATION_ERROR
- OBJECT_NOT_FOUND
- INVALID_REPOSITORY_PATH
- REQUIRED_PARAMETER_NOT_SPECIFIED
- INVALID_PARAMETER
- OPERATION_NOT_SUPPORTED
- SERVER_ERROR
- LICENSE_ERROR
Some API methods may produce more than one content type. For example, POST /operations/repositoryImport/downloadModelAttachment produces content type application/x-download when an attachment file is downloaded successfully or application/json if there is an error. You need to set your request Accept header appropriately to receive the response.
If you get a Response Code 500 with such a function that may produce more than one media type, try to switch the media type from one to the other, for example, from application/x-download to application/json.