Reports API - POST subscribe to a report
Subscribes the specified users to the specified report. All existing subscriptions remain intact.
The request consumes and produces an application/json
payload.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
Authentication
To execute this request, you need the Write configuration (WriteConfig
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
id | string |
The ID of the report to subscribe to. |
path | required |
body | ReportSubscriptions |
The JSON body of the request. Contains a list of new subscribers. |
body | optional |
Body format
The ReportSubscriptions object
Configuration of a report subscription.
Element | Type | Description | Required |
---|---|---|---|
schedule | string |
The schedule of the subscription.
|
required |
recipients | string[] |
A list of the recipients. You can specify email addresses or Dynatrace user IDs here. |
required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request. See the Example expandable section for working sample request.
{
"schedule": "WEEK",
"recipients": [
"demo@email.com",
"demo2@email.com"
]
}
Response
Response codes
Code | Description |
---|---|
201 | Success. The new subscriptions have been created. The response body contains the report ID. |
400 | Failed. The input is invalid. |
Response body
The EntityShortRepresentation object
The short representation of a Dynatrace entity.
Element | Type | Description |
---|---|---|
id | string | The ID of the Dynatrace entity. |
name | string | The name of the Dynatrace entity. |
description | string | A short description of the Dynatrace entity. |
{
"id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a",
"name": "Dynatrace entity",
"description": "Dynatrace entity for the REST API example\n"
}
Example
In this example, the request updates the report from the POST request example. It adds the weekly subscriptions for the Dynatrace user ryan.white.
The API token is passed in the Authorization header.
Curl
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/config/v1/reports/f78f78f5-00bd-4cc1-9e8b-ecfd1e379a73/subscribe \
-H 'Accept: application/json' \
-H 'Authorization: Api-token abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{
"schedule": "WEEK",
"recipients": [
"ryan.white"
]
}
'
Request URL
https://mySampleEnv.live.dynatrace.com/api/config/v1/reports/f78f78f5-00bd-4cc1-9e8b-ecfd1e379a73/subscribe
Request body
{
"schedule": "WEEK",
"recipients": [
"ryan.white"
]
}
Response body
{
"id": "f78f78f5-00bd-4cc1-9e8b-ecfd1e379a73"
}
Response code
201