{
"version": "ADTP/2.0",
"method": "check",
"headers": {
"request-content-type": "none"
},
"uri": "/",
"content": ""
}
The version field is always set to ADTP/2.0 for ADTP 2.0.
The method field
The method field can have the following values:- check
- read
- create
- update
- append
- destroy
- auth
The check method
The check method is used to check if data exists on the server at the location specified in the uri field. If the uri field is "/", then it acts as a general server health check. The server may return a sitemap in json for the client to use.The read method
The read method is used to get data from the server at the location specified in the uri field. A json object in the content field may be used for additional specificity.The create method
The create method is used to create data on the server that does not exist at the location specified in the uri field. The content field will typically contain the data being created.The update method
The update method is used to update data on the server by replacing existing data at the location specified in the uri field. The content field will typically contain the data being created.The append method
The append method is used to update data on the server by modifying existing data at the location specified in the uri field. The content field will typically contain the data being created.The destroy method
The destroy method is used to delete data from the server at the location specified in the uri field.The auth method
The auth method is used to authenticate the server. User credentials are typically stored in the content field, preferably as a json object.Note: The auth method is intentionally non-standardized and left to server implementations. Each server may define its own authentication mechanism, such as username/password, bearer tokens, or cryptographic key exchanges. Clients must follow the server’s documentation or any protocol negotiation to authenticate properly.
The headers field
The headers field is a dictionary of header fields. Each header field is represented by a key-value pair. For example, the request-content-type header field tells the server what type of data the client expects/wants to receive. While a header does not need to be standard, there are several standardized headers.- request-content-type: a colon-seperated list of MIME Types that the client wants to receive/expects. 'none' can also be used as a content-type, while * represents any.
- request-language: a colon seperated list of Language Tags that the client wants to receive/expects. * represents any.
- cookie: a colon seperated list of cookies that the server has set previously. cookies are represented as key=value. Equal signs and colons must be backslash escaped.
- content-type: the type of content being sent by the client
- content-length: an integer that represents the length of the content field.
- content-language: a Language Tags that represents the language of the content being sent. * represents any and 'none' represents no language
- range: an integer-integer pair that represents the range of the requested content that should be returned, the first integer being the start, and the second integer being the end
- agent: a string meant to convey the application type, operating system, vendor, and version of the client
The uri field
The uri field is a standard URI. It is used to specify the location of data.The content field
The content field is used to send data.Here is an example of an ADTP 2.0 response.
{
"version": "ADTP/2.0",
"status": "ok",
"headers": {
"content-type": "none"
},
"content": ""
}
The version field is always set to ADTP/2.0 for ADTP 2.0.
The status field
The status field can have the following values:- switch-protocols: The server wants to switch protocols. The content field should contain the protocol to switch to
- ok: The request was processed successfully.
- pending: The request is pending. You will receive another response when the request is complete.
- redirect: The content does not exist at this location. Check content for its new location.
- denied: The request was denied.
- bad-request: The request was malformed or incorrect in some way.
- unauthorized: The client is not authorized to perform the requested action.
- not-found: The referenced content was not found.
- too-many-requests: Too many requests have been received from the client. Please try again later.
- internal-error: An internal server error occurred.
The headers field
The headers field is a dictionary of header fields. Each header field is represented by a key-value pair. For example, the content-type header field tells the client what type of data the server is sending. While a header does not need to be standard, there are several standardized headers.- request-content-type: a colon seperated list of MIME Types that the server wants to receive/expects. 'none' can also be used as a content-type, while * represents any.
- request-language: a colon seperated list of Language Tags that the server wants to receive/expects. * represents any.
- set-cookies: a colon seperated list of cookies that the server wants the client to save. cookies are represented as key=value. Equal signs and colons must be backslash escaped.
- content-length: an integer that represents the length of the content field.
- content-language: a Language Tags that represents the language of the content being sent. * represents any and 'none' represents no language
- range: an integer-integer pair that represents the range of the requested content that has been returned, the first integer being the start, and the second integer being the end
- agent: a string meant to convey the application type, operating system, vendor, and version of the server