message field meant only for humans:
Note:The status code is the only truly reliable, machine-readable indication of what happened to the request.The
reason and message fields are provided to help troubleshoot what happened. They are both human-readable elaborations on the status code.The reason field is concise and generally has a default value that maps to its associated status code. However, it can also be overridden by AODocs APIs to provide a more precise reason than its default, generic phrase. The reason field also aims to be stable enough (part of the API “contract”) to be machine-readable for error analysis, but might get amended between major AODocs versions (usually to make it more precise).The message field is verbose and human-readable but not machine-usable in any stable or meaningful way. It can change without warning (including without major version release) and applications should not depend on its content.Common status codes in the AODocs API
| Code | Message | Description | Recommended action |
|---|---|---|---|
| 200 | OK | Everything worked out great. | Nothing to do. |
| 204 | No content | We did what you asked but there is no response. Usually used for resource deletion. | Double-check the effects of your action. |
| 400 | Bad Request | You provided something wrong in the input — something in the query is missing or not valid. | Look at the error message to see what’s wrong, but it’s usually your parameters. |
| 401 | Unauthorized | Authentication has failed or has not been provided. | Check if you included your credentials, and if they are correct. |
| 403 | Forbidden | Your credentials are valid and accepted by the server, but the action is still not authorized. | Check if you have access to the resource / action you’re trying to access / perform |
| 404 | Not Found | The resource you are looking for does not exist here at this location. | The resource was either moved to a different location or deleted. You might also have an invalid request URL. |
| 409 | Conflict | Concurrent modification is not allowed at the moment, resulting in a conflict condition. | This is the only 400-series condition you should ever retry. |
| 412 | Precondition failed | The current status of the resource does not allow the requested operation | Check error message for information on the invalid status |
| 500 | Internal Server Error | Something is wrong on our end but we have no explanation. | Retry with exponential backoff |
Error response format
AODocs APIs return two kinds of error information:- HTTP error codes (with some information in the header)
- A response-body JSON object with additional details to help you determine how to handle the error (specifically
reasonandmessagefields)
Retry basics
Some error conditions are temporary and the request can be retried later. Depending on the nature of the request and the perceived circumstance of the user, you can let them know something is wrong after any number of retries that makes sense from a UX perspective (including zero, straight away). Usually, 4xx errors should not be retried, while 5xx should. The only exception in the 4xx range is the 409 error, that indicates that a resource is being worked on by another user while trying to edit it. It should sometimes be retried. To confirm that this is the case, AODocs provides an additional hint, through a response header called “X-aodocs-retryable”: if the value of this error is “true”, then the error is expected to be transient, and the request should be retried until it succeeds. For example, if your resource is not currently in a state to allow concurrent edits from more than one party, then you could employ exponential backoff and retry several times, letting the user know that their request is being worked on, and asking them to hang on.Resolve a 400 error: Bad Request
This error means the input is incorrect — something in the query is missing or not valid. Some examples of 400 errors include:- Using mutually exclusive parameters at the same time:
- ““Parameters libraryTemplateId, sourceLibraryId and driveFolderId are mutually exclusive”
- Trying to violate the one-attachement restriction of TF/SF libraries:
- “In the google libraries the documents should always have exactly one attachment.”
- Trying to attach a Drive file without specifying its ID:
- “The file id is mandatory in attachments”
- Using a method on a library type that does not permit the method:
- “This method cannot be used in a Document Management library”
- Invalid or missing or conflicting parameter or resource field values or formats:
- “The libraryId can’t be null or empty”
- “Display name can’t be null”
- “The managed permission source can’t be null”
- “The classes with Folder acl source must contain a security category.”
- “The name of the class must be unique in the library”
Note:This is not a complete list: 400 errors are a broad category encompassing all kinds of incorrect requests.
message field.
Resolve a 401 error: Unauthorized
This error means credentials were missing or invalid (expired or unauthorized access token).Resolve a 403 error: Forbidden
This error can occur for the following reasons:- Invalid security code
- Insufficient access to a resource
- No read access to the resource
- Insufficient permission to perform a specification modification on the resource
Invalid security code
Unauthorized access to a resource
Insufficient permissions
This means the client app does not have the correct permission levels to access the resource.Sample response message 1
Sample response message 2
Resolve a 404 error: Not Found
This error can occur because of any of the following:- Missing or incorrect resource-ID (“There is no library with id: ‘OtbBk6G8Am0ATEy8P8’”)
- Resource doesn’t exist (“No entity was found matching the key: !altirnao.com:Document(“RwMUllP8yrBZFx9BWlN”)”)
Incorrect resource ID parameter
For example, if thelibraryId parameter is incorrect (not existing or misspelled), you get the following error:
message field for the “incorrect” parameter in question (in this case “Library with id `‘OtbBk68GAm0ATEy8P8’”), and verify its ID is correct.
Resource not found
If your mandatory parameter is correct, but the resource doesn’t exist, you might get the following error:Resolve a 409 error: Conflict (retry)
This error can occur because the resource is being accessed by more than one caller at the same time. The best strategy is to retry.Note:Of all 400-series errors, this is the only one that should be retried.