Supported HTTP Methods
The most commonly used HTTP methods are GET
, POST
, PATCH
, and DELETE.
The building blocks of REST APIs, these
methods define actions applied to REST resources using their URLs.
Note:
You can combine multiple operations into a single HTTP request to improve performance.Method | Works with a Singular Resource? | Works with a Collection Resource? |
---|---|---|
Yes. Gets a single resource. |
Yes. Gets a subset, or all of the resources in the collection. |
|
No. For a custom method, you can use the
|
Yes. Creates a new resource in the collection. |
|
Yes. Updates a resource. |
No. |
|
Yes. Deletes a resource. |
No. |
The GET Method
Use this method to retrieve information from a resource.
The list of parameters for querying singular and collection resources are:
limit
Positive integer value that specifies the maximum number of items that a server returns. The server might override this value to improve application performance. If the client request doesn't specify a limit value, then the server uses the default limit value of 25. This parameter applies only to collection resources.
count
Positive integer value that specifies the number of resource instances returned in the current range.
hasMore
Boolean value that indicates whether more resources are available on the server than the subset returned in the response. If the value is true, then there are more resources to retrieve from the server.
offset
- If
offset=0
, the response contains all the resources, starting from the first item in the collection. - If
offset=10
, the response contains resources starting from the 11th item.
filterBy
Defines the filter clause. When multiple values are given for a single filter field, the result would contain all entries which contain any ONE of those values (OR operation). In case of multiple filter clauses, the filtered list would be a result of an AND operation of the filters i.e., only those entries which satisfy ALL filters will be returned.
orderBy or sortBy
This query parameter determines the sort order of results in a collection by a field.
Example: description:desc
. This parameter applies only to
collection resources.
searchBy
This query parameter defines the search keyword.
q
Specifies a filter for the items to be returned from the collection. This parameter
applies only to collection resources. This query parameter defines the where clause.
The resource collection is queried using the provided expression. The value of this
query parameter is an expression (Format: ?q=expression
). Supported
comparison operators are:
=
(Equal to)!=
(Not equal to)
Example1: ?q=description=Electric
Example2: ?q=description!=Electric”
totalResults
Boolean value that indicates whether to include the total number of search records that match the query in the response. Default value is false. This parameter applies only to collection resources.
The POST Method
Use to create a new item in a resource.
The PATCH Method
Use to update data in a resource. The PATCH
method updates only the fields
specified in the request body.
The DELETE Method
Use to delete a resource. The method doesn't require a request body. The child resources inherit the functional security of the parent resource. You must have access to delete a parent resource, in order to delete its child resource.