Skip to main content
This example shows how to edit a monitoring alert using the Portal API. The call updates the alert’s lower and upper usage thresholds by sending a PATCH request to the /alerts/{id} endpoint.
This example uses cURL from the command line. You can also use an API client such as Postman. A browser’s address bar is not suitable, because it can only send GET requests and cannot add an Authorization header.

View the reference documentation

The API Reference describes the endpoints in the API, what they are used for, and the mandatory and optional information to include in your calls.

Create an access key

The Portal API uses access keys to validate that calls come from permitted sources. Before you start, create an access key and copy it to a secure location.
For instructions, see Authenticate API calls.

Add parameters

In this example, for the /alerts/{id} endpoint, the path parameter is {id}. The reference documentation for this endpoint shows that you must include the id of the alert that you want to edit. If you do not include this mandatory parameter, the call results in an error. To include a parameter in your request, replace the braces and the placeholder inside them with an actual value. For example, if the unique identifier of the monitoring alert you want to edit is 24, the request URL is:
If you do not know the monitoring alert’s unique identifier, retrieve it by making a GET request to the /alerts endpoint.
For more information about parameters, see Add path parameters.

Add a request body

The reference documentation for this endpoint shows that you must provide a request body. The request body sets the monitoring alert’s new lower and upper usage thresholds, in bytes. The following request body sets the lower threshold to 500 KB (512000 bytes) and the upper threshold to 1 MB (1048576 bytes):
The following example shows the request once you add the id parameter and the request body:
For more information about request bodies, see Add a request body.

Add your access key

To validate that you have permission to access the Portal API, include your access key as a Bearer token in the Authorization header. The following example shows the complete call with the path parameter, request body, and access key. Replace YOUR_ACCESS_KEY with your own access key:
For more information about access keys, see Authenticate API calls.

Interpret the response

If the call succeeds, the endpoint returns a response code in the 2xx range and a response body containing the updated monitoring alert. The following example shows how the response body might look:
The response body contains:
  • The id field, which contains the monitoring alert’s unique identifier.
  • The ruleType field, which contains the type of alert.
  • The target field, which identifies the SIM to which the monitoring alert applies.
  • The lowerThreshold field, which contains the lower usage threshold, in bytes, at which the alert is triggered.
  • The upperThreshold field, which contains the upper usage threshold, in bytes, at which the alert is triggered.
  • The dateCreated field, which contains the date and time at which the alert was created.
If the call fails, check the response code. A 4xx code usually means a problem with your request, such as an invalid alert id or a missing permission.
For more information about handling API responses, see Handle responses and Response and error codes.