The ADTP 2.0 Protocol

ADTP is a protocol for transferring data over a TCP connection, similar to HTTP. It uses a Request/Response model, and data is structured with json transferred in UTF-8. Here is an example of an ADTP 2.0 request.
                        
                            {
                                "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:

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.

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:

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.

The content field

The content field is used to send data.