Retrieving Data with the M2X API
Learn how to retrieve data from a single device using the M2X API. We'll walk you through the entire process - from discovering the required API call using the M2X API documentation, to acquiring all the necessary information to craft your request, to making a successful request using cURL.
In this tutorial we’ll be retrieving device data from a single device. Review the API Documentation for this request to determine your options.
This API request will need to include the
Stream Namewhich can be found on the Device Dashboard.
All Device level requests must be authenticated by including a Device or Master API Key in the
X-M2X-KEYheader. Device level API keys are accessible under the API Keys tab of Device Dashboard.
Now you have all the information you will need to craft the API request. Test out the request on the command line using cURL:
curl -i "https://api-m2x.att.com/v2/devices/[DEVICE-ID]/streams/[STREAM-NAME]/values?[OPTIONAL-PARAMETERS]" -H "X-M2X-KEY: [MASTER-API-KEY]"