Collecting data using REST APIs

Use REST APIs to send data to TrueSight Intelligence. The API endpoint URL is: https://api.truesight.bmc.com/

For more information, see TrueSight Intelligence SDK for Java on GitHub . To use an SDK that supports the Post methods for metrics, measurements, and events, see Using the TrueSight Intelligence SDK for Java.

Related topics

Using the TrueSight Intelligence SDK for Java

Interactive API and API Documentation

Searching for data

Managing sources

Make an authenticated REST API call.


Add metric(s) to your account.


Add measure(s) for the metric(s) you added to your account.


Send events along with values to your account.

To make an authenticated REST API call

  1. Navigate to Admin > Account Manager and view the Product Security section to view security details.
  2. Copy the API token to a temporary location. For more information, see the Product Security section of the  TrueSight Account Manager.

    Note

    Your email address and API token are used to ensure authorized REST APIs send data to your account. Share the API key with authorized individuals only.

  3. 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.
Example: Retrieve events from your account
curl https://api.truesight.bmc.com/v1/events \
-u <email>:<API token> \

API methods used to manage metrics

Note

The following examples use cURL on a Linux computer for transferring data to TrueSight Intelligence.



    This example creates a metric named freememorysize, for a source type titled Sample_Device.

    Required fields

    To send metric data, you must provide values for the name, displayName, displayNameShort, unit, and defaultAggregate fields.

    POST - Create a metric

    This example creates two metrics, freememorysize and totalmemorysize for a source type titled Sample_Device.

    POST - Create a batch of metrics
    curl https://api.truesight.bmc.com/v1/batch/metrics \
    -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.

    GET - View the list of metrics
    curl https://api.truesight.bmc.com/v1/metrics \
    -X GET \
    -u <email>:<api-token>

    For more information, see /v1/get/metrics.

    PUT - Update the values for a metric
    curl https://api.truesight.bmc.com/v1/metrics/:Metric_Name \
    -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 .

    DELETE - Remove a metric
    curl https://api.truesight.bmc.com/v1/metrics/Metric_Name \
    -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

    Note

    The following examples use cURL on a Linux computer for transferring data to TrueSight Intelligence.



      Note

      Create a metric before you add measure data for the metric.

      This example sends one data point 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.

      Required fields

      To send measurement data, you must provide values for the source, metric, and measure fields.

      POST - Create a measurement for a metric

      For more information, see  /v1/post/measurements.


      Note

      Create a metric before you add measure data for the metric.

      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.

      POST - Create batch measurements for metrics
      curl https://api.truesight.bmc.com/v1/measurements \
      -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.

      GET - List of measurements associated to a metric
      curl https://api.truesight.bmc.com/v1/measurements/CPU?start=1416863824973&end=1416863825973 \
      -X GET \
      -u <email>:<api-token>

      For more information, see  /v1/get/measurements/:metric.

      API methods used to manage events

      Note

      The following examples use cURL on a  Linux computer for transferring data to TrueSight Intelligence.

      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.

      Ensure that the value of the fingerprint fields are not changed when sending multiple values for other event parameters.

       


        This example creates an event using Unix time in milliseconds as 1459299931000 (3/29/2016, 6:05:31 PM PST).

        Required fields

        To send event data, you must provide values for the title, source.ref, source.type and fingerprint fields.


        POST - Create an event

        Use event query parameters  to list events. For more information, see /v1/get/events.

        GET - View the list of events
        curl https://api.truesight.bmc.com/v1/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.


        Info

        • Use the eventClass field to assign a type to the event. This is used by TrueSight Intelligence to categorize events, and you can filter the event list using this field. For example, if you are sending events from various social media sources and want to bucket them, use Social as the value for eventClass.
        • Use the app_id field to associate the event to a TrueSight Intelligence App. Navigate to Apps, select your application, and click Events to view the associated events.

        For more information, see  /v1/post/events.

        Was this page helpful? Yes No Submitting... Thank you

        Comments