HTTP Verbs

HTTP Verbs

HTTP Verbs

Access to resources MUST be done using the appropriate HTTP Verb. HTTP verbs MUST be used in compliance with their definitions under the HTTP standard. The action taken on the representation will be contextual to the media type being worked on and its current state.

Usage of the verb MUST correspond to the desired action (e.g. DELETE for removing a resource).

One notable and oft used exception is using POST in what is essentially a GET situation because of URL length restrictions or due to the complexity of the filtering specification. See Searching and Filtering for details.

The following table shows standard HTTP verbs followed by Trimble’s standards for the behavior and use of each verb.

VerbPurposeDescriptionIdempotent
POSTCreateCreate a new resource within the specified collection.
POSTing an extant resource MUST generate an error.

The request MUST contain a body that is the resource to be created.
Potentially
POSTSearchSearch a collection - The body of the POST is the specification for the search. See Filtering Using a Service-Specific Query Payload for the details of the search method and body.Yes
PUTReplaceUpdate an existing resource by replacing it with a complete instance.

PUT SHOULD be used in cases where the resource is not intended to be editable, like an image or a file.

PUT SHOULD NOT be used in situations where a resource is being edited. PATCH SHOULD be used in these cases.

The request MUST contain a body that is the complete representation of the resource.
Yes
PATCHUpdateUpdate an existing resource by replacing some of its properties.Potentially
GETRetrieveRetrieve a resource or resources specified in the URL.
The request MUST NOT require a body
Yes
DELETEDeleteDelete the single resource specified in the URL.
The request MUST NOT require a body
Yes

POST and complex search actions

The one exception to standard usage of HTTP verbs is using POST for resource searching and filtering. This exception is in place due to URL length restrictions or filtering specification complexity. POST endpoints for this use case MUST meet the following criteria:

  • Endpoint MUST expose only search functionality with filtering
  • Endpoint MUST end in /searches
  • Endpoint MUST NOT modify data