Supported HTTP Methods

You can have standard methods and custom actions that you can use to interact with the resources. For more information regarding the supported resource methods, refer to the Tasks section of this guide.

Note:

Child resources usually inherit security privileges from their parent resource. Therefore, to use a method on a child resource, you may need to have access to use that method on the parent resource. However, there may be some child resources with different privilege requirements to access them.

You can execute the standard methods to interact with the various resources, using their URLs. The following table lists the supported HTTP methods.

Method Description

GET

Retrieve a single or multiple records of the resource.

POST

Create a new record for the resource.

PUT Replace a record of a resource with new data. Creates new record if it doesn't exists.

PATCH

Update a record of the resource.

DELETE

Delete a record of the resource.

The HTTP methods that are expected to have a request body (POST, PUT, PATCH) shouldn't be sent with zero bytes empty body, even if there is no need to send any parameter. We strictly recommend to send an empty JSON object ( curly brakets {} ) as the minimal valid JSON request.

For custom actions, the POST method applies to both a singular resource and a resource collection. Each method is discussed in detail in the following sections. For more information on Custom Actions, refer to Custom Action section.

GET

Use this method to query and retrieve information. You can use this method to retrieve a single record or a list of records. The list of records is referred to as a collection.

The following table lists the parameters that can be used in a GET method for querying a collection.

Parameter Description

limit

A positive integer value that specifies the maximum number of items that a server returns. The server might override the value to improve performance. If the client doesn't specify a limit value, then the server uses a default limit value.

offset

A positive integer value that specifies the index of the first item to be returned. The offset index begins at 0. For example, to return items in a collection, use the following:

  • offset=0 to return all items starting from the first item in the collection.
  • offset=10 to return all items starting from the 11th item.

Note:

Specify values for both the limit and offset query parameters to obtain a paginated response.

For example, if there are 100 opportunities and a client sends the request GET /opportunities?offset=10 &limit=20, then the response contains opportunities from 11 to 30.

Note:

  • There is no implicit ordering if the client specifies only the limit and offset parameter.
  • For limit and offset parameters, the client may encounter inconsistencies if the collection resource is updated between paging requests.

POST

Use this method to create a new item. The request media type is as follows:

application/json

PATCH

Use this method for making partial updates to a resource. Only the fields contained in the request body are updated. The request media type is as follows:

application/json

PUT

Use this method to create a new item or to replace an existing one. The request media type is as follows: application/json.

DELETE

Use this method to delete a resource. It doesn't require a request body.

Custom Action

Sometimes a resource exposes a custom action that isn't the standard Create, Read, Update, and Delete (CRUD) action. A custom action is always initiated using a POST method. The relevant request media type is as follows:

application/json

The response media type is as follows:

application/json

Custom action requests always have URLs of the form "custom-actions/ACTION" in URL. For example:


POST /rest/ofscCore/activities/12345/custom-actions/start 
{ "time" : "2016-01-01 12:00" }