the path to the resource that the client is requesting
below are some examples of valid resource fields:
/
/index.html
example.com/index.html
example.com:8080/index.html
example.com:8080/route?query=string
example.com:8080/route?query=string#fragment
path/to/resource
jsontp://example.com:8080/path/to/resource
different servers may handle this differently, so it is ideal to send requests in the first or second format, which is / followed if necessary by the path to the resource
below are the list of HTTP methods mentioned in the standard:
GET
POST
PUT
DELETE
OPTIONS
bear in mind that the server may not support all of these methods, as it only is required to support GET and POST. If the server does not support the method, it will respond with a 405 Method Not Allowed status code
the raw text to be sent as the body of the request.
if the content field is not present, the request is either a POST or PUT request, and the header "expect": "100-continue" is not present, the server will respond with a 400 Bad Request status code
if the client is planning to send a large request, it can send the header "expect": "100-continue" to the server
this tells the server to bear in mind that the client is planning to send a large request, and so it should not timeout as quickly
if the server does not support the 100-Continue header, it will respond with a 501 Not Implemented status code
if the server supports the 100-Continue header, it will respond with a 100 Continue status code, and the client can then send the full request, in the same format as above. Notably different from HTTP, the full request is sent, not just the body
example of a request with the 100-Continue header:
{
"jsontp": "1.0",
"type": "request",
"resource": "/path/to/resource",
"method": "GET",
"headers": {
"expect": "100-continue" // required (obviously!)
},
"body": {} // if not empty, it will be ignored
}
once the server responds with a 100 Continue status code, the client can send the full request, in the same format as above