Add a request body
You use a request body when you create or update resources. The request body is a representation of the resource. For example, if you want to create a new monitoring alert using the API, you make a POST request to the /alerts endpoint, and include a request body in your call.
The API Reference documentation for each endpoint indicates whether the endpoint requires a request body. For endpoints that require a request body, the documentation provides the following information:
- A list of mandatory and optional fields
- A description of each field in the request body
- An example of a valid request body
Example request body
The following example shows a request body for the monitoring alerts endpoint.
{ "ruleType": "sim", "target": "8944999999248275001", "lowerThreshold": "512000" "upperThreshold": "1048576" }
In this example, the request body is being used to:
- Create a subscriber-level monitoring alert ("ruleType": "sim",).
- Apply the alert to a subscriber with an ICCID of 8944999999248275001.
- Set a lower alert threshold of 500KB.
- Set an upper alert threshold of 1MB.
Example API call with a request body
The following example shows how to format the monitoring alerts request body within an API call.
POST "https://connectivity-eu-api.pelion.com/alerts" -d "{\"ruleType\":\"sim\",\"target\":\"8944999999248275001\",\"lowerThreshold\":\"512000\",\"upperThreshold\":\"1048576\"}"