HTTP Methods

The Sentinel EMS REST API supports the HTTP methods described below for interacting with resources.

HTTP Method Description
POST

A POST request is used to create a new resource.

This request is also used to perform operations for which none of the other HTTP methods seems appropriate.

 

About the Location Header

If the POST request results in the creation of a resource, the response includes a Location header with the address of the new resource.

GET

A GET request is used to retrieve data.

This request does not perform any update on the server. The GET method is used to do the following:

>Retrieve details of a resource.

>Search resources based on given query parameters.

The GET method supports the embed query parameter, which helps in dynamically selecting the output.

You can also use pagination, sorting, and filtering parameters to navigate through a list.

PUT

A PUT request is used to replace a resource.

Use the PUT method to update a resource (available at the given URI) with another resource.

Following are some points to consider when using the PUT method in the request body:

>If a parameter is not provided, the existing database value for that parameter will be replaced by blank or default.

NOTE   This is the main difference between PUT and PATCH. In PUT, the parameter will be replaced by blank or default, whereas in PATCH, the parameter will remain unchanged.

>If a parameter is set to blank, the database value will be updated with blank.

>If a parameter is set to a valid value, the database value will be updated with the given value.

 

Association Behavior

PUT should not be used to remove associations.

>If an association list is provided in the input, the existing list will be replaced by the provided list.

>If a blank association list is provided, no action will be taken.

PATCH

A PATCH request is used for partial updates to an existing resource. In this case, all the values that are part of the request are updated.

Following are some points to consider when using the PATCH method in the request body:

>If a parameter is not provided, the existing database value for that parameter will remain unchanged.

NOTE   This is the main difference between PUT and PATCH. In PUT, the parameter will be replaced by blank or default, whereas in PATCH, the parameter will remain unchanged.

>If a parameter is set to blank, the database value will be updated with blank.

>If a parameter is set to a valid value, the database value will be updated with the given value.

 

Association Behavior

PATCH should not be used to remove associations.

>If an association list is provided in the input, the existing list will be replaced by the provided list.

>If a blank association list is provided, no action will be taken.

DELETE

A DELETE request is used to remove a resource.

You can use the DELETE method to delete an entity or to remove one or more associations from an entity.

The returnResource Parameter

POST, PUT, and PATCH requests support an optional request parameter, returnResource, which has the Boolean data type. This parameter controls whether or not to return a created/updated resource in the response body.