Getting Started


Getting Started with the Thing+ REST API

  1. Thing+ Service registration & Hardware installation
  2. Prerequisites
  3. Using the Thing+ REST API with an OAuth Access token
  4. Try some APIs
  5. Code Samples
  6. Thing+ REST API Quick Reference

Step 1. Thing+ Service registration & Hardware installation

Step 1-1

Step 1-2

Step 2. Prerequisites

Step 2-1. Postman for getting started with the Thing+ REST API

Step 2-2. Import a Postman collection

  1. Click the ‘Import’ button
    import

  2. Select ‘Download from link’
    import link - Add the below link
    • https://www.getpostman.com/collections/f1c2d8efb311d579eff6
      • Click the ‘Import’ button

  3. Close the module

Step 2-3. Check the imported collection

  1. Select the ‘Collections’ tab and then select the ‘Getting Started with the Thing+ REST API’ collection



collection

Step 2-4. Creating a Thing+ OAuth Client ID & Client Secret Key

  1. Open Chrome browser then Sign in to the Thing+ Portal
    interceptor enable

  2. Launch Postman

  3. Enable interceptor
    interceptor enable

  4. Install interceptor
    https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo
    interceptor enable

  5. Getting a Client ID and Secret
    - HTTP Method: POST
    interceptor enable
    1) Select a Getting a client ID and secret on the collection
    2) Select a ‘Body’ tab
    3) Select a ‘raw’
    4) Add a “reqId” for OAuth2.0 client credentials
        • Client ID is used to identify the application using Thing+ Rest API
    5) Add a “clientSecret” for OAuth2.0 client credentials
        • Client Secret is used to authenticate the identity of the application using Thing+ Rest API
    6) Add a “name”
        • This name is used to request access a user’s account
          Ex) your company or service name
    7) You can change “Scopes” if you need any change Scopes limit access for OAuth tokens
    8) Click the ‘Send’ button

  6. Check the ‘201 Created’ result status
    interceptor enable

  7. Disable interceptor
    interceptor disable

Step 2-5. Obtaining an OAuth Access token with Authorization Code Grant type

An Access token Expires in 15 days (possibly can be changed without advance notification)

  1. Launch Chrome browser with below URL
    • replace {CLIENT_ID} and {REDIRECT_URI} to your Client ID and your Service URI
    • https://api.thingplus.net/v1/oauth2/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}
    • {CLIENT_ID} : Thing+ OAuth Client ID to received at Step 1-4
    • {REDIRECT_URI} : The URL in your app where users will be sent after authorization
      • Ex) http://www.daliworks.net interceptor enable

  2. Click the ‘Allow’ button

  3. Then Thing+ redirects back to your {redirect_uri} with “code” in url interceptor enable

  4. Exchange code for an OAuth Access token
    - HTTP Method: POST
    interceptor enable
    1) Select a Exchange code for an OAuth Access token on the collection
    2) Select a ‘Body’ tab
    3) Select a ‘x-www-form-urlencoded’ (application/x-www-form-urlencoded)
    4) Add a “code” in url above
        • The code you received as a response in url above
    5) Add a your “client_id”
       • The client ID you received from Thing+ when you registered your application
    6) Add a your “client_secret”
       • The client secret you received from Thing+ when you registered your application
    7) Add a your “redirect_uri”
       • The redirect URL when you registered your application
    8) Click the ‘Send’ button

  5. Check the ‘200 OK’ result status and Access token

interceptor enable

Step 3. Using the Thing+ REST API with an OAuth Access token

Step 3-1. Create a Postman Environments

  1. Launch Postman

  2. Select the ‘Manage environments’ environment

  3. Click the ‘Add’ button environment add

  4. Add a ‘Key’ and ‘Value’ and Click the ‘Submit’ button environment submit
    • Add a ‘Thing+ Access Token’ to ‘New environment’ field.
    • Add a AccessToken (Case Sensitive) to ‘Key’ field.
    • Add a your OAuth Access Token to ‘Value’ field.
    • Close the modal
  5. Select a ‘Thing+ Access Token’ import

Now you are ready to use the Thing+ REST API with an OAuth Access token

  • ‘Getting Started with the Thing+ REST API’ collection uses variable for the ‘Authorization’ http header environment variable

Step 4. Try some APIs

Useful tip before trying some APIs with postman

Gateway

  • Reading gateways
    • Select a Reading gateways on the collection and Click the ‘Send’ button.
      • You can get your gateways’s ID
    • Request URL
      • [GET] https://api.thingplus.net/v1/gateways
      • The response type is Array

    http header

  • Reading gateways with queries
    • Select a Reading gateways on the collection and Click the ‘Send’ button.
    • Request URL
  • Reading a specific gateway

    To be updated

Sensor

  • Reading sensors

    To be updated

  • Reading sensors with queries

    To be updated

  • Reading a specific sensor

    To be updated

Timeline

  • Reading Collection

    To be updated

  • Reading Collection with queries

    To be updated

  • Reading a Item

    To be updated

Step 5. Code Samples


Thing+ REST API Quick Reference

Resource Request URL
gateways [GET] https://api.thingplus.net/v1/gateways
  [GET] https://api.thingplus.net/v1/gateways?embed=sensors
gateway [GET] https://api.thingplus.net/v1/gateways/{gatewayId}
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}?embed=sensors
gateway status [GET] https://api.thingplus.net/v1/gateways?embed=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}?embed=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/status
sensors [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors
sensor [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}
sensor status [GET] https://api.thingplus.net/v1/gateways?embed=sensors&sensors[embed]=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}?embed=sensors&sensors[embed]=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors?embed=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}?embed=status
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}/status
sensor value(latest) [GET] https://api.thingplus.net/v1/gateways?embed=sensors&sensors[embed]=series
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}?embed=sensors&sensors[embed]=series
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors?embed=series
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}?embed=series
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}/series
sensor value(series) [GET] https://api.thingplus.net/v1/gateways/{gatewayId}?embed=sensors&sensors[embed]=series&sensors[series][dataStart]={startDate}&sensors[series][dataEnd]={endDate}&sensors[series][interval]=1m
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors?embed=series&series[dataStart]={startDate}&series[dataEnd]={endDate}&series[interval]=1m
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}?embed=series&series[dataStart]={startDate}&series[dataEnd]={endDate}&series[interval]=1m
  [GET] https://api.thingplus.net/v1/gateways/{gatewayId}/sensors/{sensorId}/series?dataStart={startDate}&dataEnd={endDate}&series[interval]=1m
timelines [GET] https://api.thingplus.net/v1/timelines
timeline [GET] https://api.thingplus.net/v1/timelines/{timelineId}