Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Dear All,
I need to send sensor data to ThingWorx through GPRS module SIM808 connected to Arduino UNO. This requires using AT Command to start REST API (HTTP).I need support on how to form the below information in one http url to send it using AT Command AT+HTTPPARA
POST /Thingworx/Things/mything/Services/AlarmService HTTP/1.1
Host: academic.cloud.thingworx.com
appKey: b73a20dd-e142-4017-8eyy-a26xx
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: add4f5b4d-ferf8-8e52-31ds-10ad6571asdsd
Solved! Go to Solution.
Hi,
"AT+HTTPINIT" // Initiate
"AT+HTTPPARA"="CID",1
"AT+HTTPPARA=\"URL\",\"http://www.yourdomain.com/Thingworx/Things/<ThingName>/Services/<ServiceName>?appKey=XXXXXXXXXX\"""
"AT+HTTPPARA=\"Content\",\"application/json\"" // Content type
"AT+HTTPDATA=357, 40000"; // Size of the data
Use buffer to construct your data in JSON format.
Example: {"Temp1":"23","Temp2":"24"}
AT+HTTPACTION=1 // POST Data
AT+HTTPREAD // Read Response
AT+HTTPTERM // Terminate
Hi,
"AT+HTTPINIT" // Initiate
"AT+HTTPPARA"="CID",1
"AT+HTTPPARA=\"URL\",\"http://www.yourdomain.com/Thingworx/Things/<ThingName>/Services/<ServiceName>?appKey=XXXXXXXXXX\"""
"AT+HTTPPARA=\"Content\",\"application/json\"" // Content type
"AT+HTTPDATA=357, 40000"; // Size of the data
Use buffer to construct your data in JSON format.
Example: {"Temp1":"23","Temp2":"24"}
AT+HTTPACTION=1 // POST Data
AT+HTTPREAD // Read Response
AT+HTTPTERM // Terminate
Thanks Velkumar R for your response
All is clear except attaching Thing name as mentioned in your Example: {"Temp1":"23","Temp2":"24"}
if i have two Things and need to update their values top platform, how can i attach them with your mentioned flow
Hi Mohamed,
{"Temp1":"23","Temp2":"24"} is Tag and its Data. Tag must be identical to inputs of service.
If you need to update two things you need to change "Thing Name" in URL
www.yourdomain.com/Thingworx/Things/<ThingName>/Services/<ServiceName>?appKey=XXXXXXXXXX\
Hi Mohamed,
I think SIM 808 support only 3 HTTPACTION
AT+HTTPACTION = 0 // Read
AT+HTTPACTION = 1 //Post
AT+HTTPACTION = 2 // Head
Please check, I am not sure about that.
For REST API calls in thingworx, check below link
To invoke service, post is working fine, Thanks for support Velkumar R
For updating certain SENSOR DATA, I have constructed JSON and attached it as below, but still not reflecting in sensor value, still service only is invoked, but sensor data is not updated on ThingWorx
StaticJsonBuffer<200> jsonBuffer;
JsonObject& rootdata = jsonBuffer.createObject();
rootdata["Name"] = "52";
mySerial.println("AT+HTTPPARA=\"USERDATA\",rootdata");
Could you please assess?
Could you please check this way of attaching data to my Thing
For updating certain SENSOR DATA, I have constructed JSON and attached it as below, but still not reflecting in sensor value, still service only is invoked, but sensor data is not updated on ThingWorx
StaticJsonBuffer<200> jsonBuffer;
JsonObject& rootdata = jsonBuffer.createObject();
rootdata["Name"] = "52";
mySerial.println("AT+HTTPPARA=\"USERDATA\",rootdata");
Could you please assess?
Hi Mohamed,
Did you find any error in applicaion log (TWX Platform) and what is the response code in SIM 808 while posting data.
here is the error from ThingWorxs ,
[context: com.thingworx.webservices.context.HttpExecutionContext@78cb6519][message: Entity Not Found : [ConfiguredThing]]
from Arduino, i receive DOWNLOADas response to AT+HTTPACTION=1
Hi Mohamed,
Create appKey with user reference as "Administrator" and try to POST data (or) give visibility permission to "ConfiguredThing" for appKey reference user.
About Response code, if data is posted successfully you will get response code as 200