Collecting data using REST APIs
To make an authenticated REST API call
- Navigate to Admin > Account Manager and view the Product Security section to view security details.
Copy the API token to a temporary location. For more information, see the Product Security section of the TrueSight Account Manager.
- Provide this key as part of the header.
Replace <API token> in the example below with your account TrueSight Intelligence API key and replace <email> with your account email address.
-u <email>:<API token> \
API methods used to manage metrics
This example creates two metrics, freememorysize and totalmemorysize for a source type titled Sample_Device.
-X POST \
-u <email>:<api-token> \
-H "Content-Type: application/json" \
-d '[
{
"name": "freememorysize",
"description": "Size of the Free Memory",
"displayName": "Free Memory Size",
"displayNameShort": "Free Mem",
"unit": "bytecount",
"defaultAggregate": "avg",
"type":"Sample_Device"
},
{
"name": "totalmemorysize",
"description": "Total Memory Size",
"displayName": "Total Memory Size",
"displayNameShort": "Total Mem",
"unit": "bytecount",
"defaultAggregate": "avg",
"type":"Sample_Device"
}
]'
For more information, see /v1/post/batch/metrics.
-X GET \
-u <email>:<api-token>
For more information, see /v1/get/metrics.
-X PUT \
-u <email>:<api-token> \
-H "Content-Type: application/json" \
-d
' {
"description": "A new description",
"displayName": "My metric",
"displayNameShort": "My met",
"unit": "number",
"defaultAggregate": "avg"
}'
For more information, see https://api.truesight.bmc.com/documentation#/metrics.
-X DELETE \
-u <email>:<api-token> \
-H "Content-Type: application/json"
For more information, see /v1/delete/metrics/:metric.
For more information, see /v1/post/metrics.
API methods used to manage measurements
This example sends two data points using Unix time in milliseconds as 1459286820000 (3/29/2016, 2:27:00 PM PST). This API call should be repeated for the time range with required time interval and data values.
-X POST \
-u <email>:<api-token> \
-H "Content-Type: application/json" \
-d '
[
[
"sample.corp.com",
"freememorysize",
3.0,
1459286820,
{"origin":"sample.corp.com"}
],
[
"sample.corp.com",
"totalmemorysize",
3.0,
1459286820,
{"origin":"sample.corp.com"}
]
]'
For more information, see /v1/post/measurementsBatch.
-X GET \
-u <email>:<api-token>
For more information, see /v1/get/measurements/:metric.
API methods used to manage events
Events are uniquely identified by the fingerprint fields and grouped by event class.Fingerprint fields are defined to have unique values that do not change with time. For example, an event ID is used to identify an event, and the status of the event can be either 'open' or 'close'. The event ID field is never updated in this case. If the value for any fingerprint field is changed, a new event is created.
Use event query parameters to list events. For more information, see /v1/get/events.
-X GET \
-u <email>:<api-token>
For more information, see /v1/get/events/:event_id.
Use event query parameters to list raw events. For more information, see /v1/get/events/raw.
For more information, see /v1/post/events.