Step 4: Create the Topic

  1. On the DataGator API web page under user click the purple "POST" button with "/users/{id}/topics" to the right of it near the bottom.
  2. In the "id" box paste in a copy of your user "id" saved at the end of step 1 without quotes.
  3. In the "data box" supply the link created in step 3 as a value of the "topicURI" key formatted as JSON. Example at the end of this step.
  4. From the box labeled "Response Body" make a copy of the value of "id".
Example Topic request data.
{
"topicURI": "https://thingspeak.com/channels/172857/fields/4.json"
}

Step 5: Add Aggregates to the Topic.

  1. Click on the Topic heading near the top to open the topic list.
  2. Near the top click the purple "POST" button with "/Topics/{id}/aggregates" to the right of it.
  3. In the "id" box paste in a copy of the Topic "id" without quotes from the end of step 4.
  4. In the "data" box enter in JSON providing values for the keys "aggregateName", "aggregateMethod" and "period".
Aggregate request example:
{
"aggregateName": "Open",
"aggregateMethod": "Open",
"period": 1357
}

A note about "period": The value "period" can be any number seconds. For example I chose 1357 which is about 22 minutes 22 seconds. In this demo using public data from this broker I recommend something in the range of 1200 to 14,400.

IMPORTANT: You must use the exact same value for "period" in all 4 of the different "Open", "High", "Low" and "Close" Aggregates.

Step 6: Create additional Aggregates.

  1. Repeat sub steps 3 and 4 changing the values of "aggregateName" and "aggregateMethod" to "High".
  2. Repeat sub steps 3 and 4 changing the values of "aggregateName" and "aggregateMethod" to "Low".
  3. Repeat sub steps 3 and 4 changing the values of "aggregateName" and "aggregateMethod" to "Close".