cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

REST API on IoT Device

shreekant
10-Marble

REST API on IoT Device

Hi,

 

I want to use REST API to send sensor data from my device to Thingworx foundation server.

 

I have created Mashup on Thingworx server.

 

I have tried with the example given at https://developer.thingworx.com/en/resources/guides/thingworx-rest-api-quickstart

 

It works fine for me. Now I want to replace HTTPie application with my device to update Things property SomeNumber. I am using SIM800 module for communication.

 

Is there any example given for the device using REST API?

Please guide. 

 

4 REPLIES 4

How are you sending commands to the SIM800 module? Here is a tutorial for using the SIM800 with an Arduino. You will need to change the GET command from the example to send a command that works with ThingWorx:

https://exploreembedded.com/wiki/Setting_up_GPRS_with_SIM800L

 

Hi,

 

Thanks for your reply.

 

I am sending commands to SIM800 module on serial port(UART).

 

BTW, I don't  understand what you are saying "You will need to change the GET command from the example to send a command that works with ThingWorx"

 

can you elaborate it please?

 

Thanks,

shreekant

In the example I linked above, they use 3 commands to connect to a server and send an HTTP GET message:

1. Open a TCP connection to the destination URL.

2. Set the number of bytes that will be sent.

3. Send the actual bytes - "GET explor..."

 

You will need to open a connection to a ThingWorx server, and change the other two commands to ones for setting a property value. You can see an example of the bytes that need to be sent for an HTTP PUT here:

https://developer.thingworx.com/en/resources/guides/thingworx-rest-api-quickstart/use-rest-api-set-property-value

What device is sending the bytes to the SIM800 serial port? If the device sending the bytes has an HTTP library available it will make sending HTTP commands much easier.

Hi,

 

thanks for your advice. I have tried a lot but I am not been able to get the PUT method to work.

 

I am putting this on hold for now. May be I will try it with another GSM module.

 

See you again.

 

Thanks,

shreekant

Announcements


Top Tags