Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

6. Get/set property values using REST API


  1. Check out
the
  1. the GadgetKeeper API - Thing Properties
page for details
  1.  page for details on how to
interact with properties
  1. perform basic method operations on GadgetKeeper API
using
  1. using cURL
or a
  1.  or a REST API
tool.Seven basic property methods are possible with the GadgetKeeper API:
  •     Create property with the given details (Property id is returned)
  •     Get property details from Id (includes details as shown in step 2)
  •     Get a list of properties with given thing Id (returns an array of property details)
  •     Get property value with given thing Id and property Id
  •     Get values of all properties with given thing Id (returns array of values by property Id)
  •     Set a value to property with given property Id and thing Id
  •     Delete property with given property Id and thing Id
          5. Some methods require a thing Id, a property Id, and/or an API Key value:
  • To obtain the Thing Id, see instructions here.
  • To
    1.  tool
    2. Obtain required parameters:
      1. obtain the Thing Id, see instructions here.
      2. obtain the property Id, such as "temperature", see instructions here
    .
    To
      1. create
    an
      1. an API Key, see instructions here
    .
          6. Use
    1. Use API Explorer
    or
    1.  to perform REST calls
    manually on the
    1. using UI
          7. Use cURL to
    1. Use cURL to perform REST calls using command lines:

              To get property value:

    Code Block
    languagebash
    curl -i -X GET -H "X-ApiKey: <API_KEY>" "http://api.gadgetkeeper.com/v1/things/<THING_ID>/properties/<PROPERTY_ID>/value.json"

              To set property value: 

    Code Block
    languagebash
    curl -i -X PUT -H "X-ApiKey: <API_KEY>" -H "Content-Type: text/json; charset=UTF-8" -d '{"unitOfMeasure":"celsius","ledColor":"red"}' "http://api.gadgetkeeper.com/v1/things/<THING_ID>/properties/<PROPERTY_ID>/value.json" 

          8. The "GET" and "PUT" operations in this example perform the same function as the "Get" and "Set" buttons in the previous step for UI

     

    7. Get/set structured data type using REST API

    1. See GadgetKeeper API - Data Types for details on how to define structured data types using cURL or REST API methods
    2. There are three possible methods for handling structured data types with the GadgetKeeper API:
      • Create structured data type with given details (an array of data elements with their parameters is also given)
      • Get details for a structured data type (returns details with an array of data elements)
      • Delete structured data type with the given name

          3. No Id values are needed for these methods
          4. If an API Key is needed, see instructions here.
          5. For more information on REST API, see: