Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Dear,
i'm trying to update property value on thingworx through Arduino connected to GPRS modem, i'm using HTTP PUT using AT command as per below, i always get error after last line
AT+CREG?
AT+CGACT?
AT+CMEE=1
AT+CGATT=1
AT+CSTT="etisalat"
AT+CIICR
AT+CIFSR
AT+CIPSTART="TCP","34.202.124.XX","443"
AT+CIPSEND
PUT /Thingworx/Things/etiajmp_mohamedkhalil1711/Properties/mykidname?appKey=58b3eb57-36ef-4f59-aa45-79b60099bXX2 HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip,deflate
Connection: keep-alive
Content-Length: 21
Content-Type: application/json
Host: 34.202.124.206
{"mykidname" : "Amr"}
#26
Here is the output i get
AT+CIPSTART="TCP","34.202.124.206","443"
OK
CONNECT OK
TCP connection success
AT+CIPSEND
> PUT /Thingworx/Things/etiajmp_mohamedkhalil1711/Properties/mykidname?appKey=58b3eb57-36ef-4f59-aa45-79b60099b052 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip,deflate
Connection: keep-alive
Content-Length: 21
Content-Type: application/json
Host: 34.202.124.206
User-Agent: HTTPie/0.9.6
{"mykidname" : "Amr"}
#26
ERROR
CLOSED
TCP connection is closed by remote server
Please check and help
Hi Mohammed,
Being able to use a direct PUT command would require changing the platform subsystem settings to "Allow Request Method Switch" and turn off "Filter Content Type", but this can also open the platform up to cross site scripting vulnerabilities (but it would work). The other option is to create a custom service on the same thing to save the value to the property and send a POST transaction with the defined service parameter to accept the property value.
Thanks,
Adam
Thanks Adam Ressler , i have few comments
1-Why PUT works fine on same thing and property when i use Postman but doesn't when i use AT commands
2-For the other option, if i need to update pressure or Temperature value, do you mean that i have to create many services like
servicepressure1,servicepressure2 ,.....servicepressure100,....then when i need to set property value pressure=50, i have to POST servicepressure50 and when i need to set value to 55, i have to post service servicepressure55,
This would be very time consuming and there is huge probability for errors
3-Lastly, if i change platform subsystem settings, would my code that i put in my earlier poster work, or it needs modification?
adding to my reply,
what if i need to update long/lat property, in this case triggering predefined service wouldn't help
Dear Adam Ressler , Here is the latest updates
i changed platform subsystem as per your recommendation
AT+CIPSTART="TCP","34.202.1xx.xx","6725"
AT+CIPSEND
PUT /Thingworx/Things/arduinothing/Properties/mykidname?appKey=c55af751-41e5-4c45-8eb4-9f3e3a86ac99 HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip,deflate
Connection: keep-alive
Content-Length: 21
Content-Type: application/json
Host: 217.165.211.74
{"mykidname" : "Amr"}
#26
i still have no update on thingworx when i run the below AT Commands from Arduino
ERROR
CLOSED
TCP connection is closed by remote server
and get above error once i run above command sequence
Please check and help if possible
Hi, Mohamed Khalil
Do you solve using HTTP AT or TCP/IP AT command to POST json to Thingworx?
HTTP AT returned 500 always error code.