Message Boards Message Boards

0
|
9598 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Send data to multiple variables in DataDrop via its API?

Posted 7 years ago

Hello I am new in Wolfram so I am trying to send data to Cloud. I dave databin URL addres but in here i can send only values. For instance;

at#httpcfg=0,\"datadrop.wolframcloud.com\",80,0\r
at#httpqry=0,0,\"/api/v1.0/Add?bin=my_ID&45

I can send like this(45) but I am reading data from sensor so i need to put variables in there like

at#httpqry=0,0,\"/api/v1.0/Add?bin=my_ID&x_angle

but this is not correct.What can I do? How can I determine this? I will not send directly values, I will put variables name and after when variables get data, it sends from there. I hope it is clear Thank you!

POSTED BY: ismail dundar
4 Replies
Posted 7 years ago

Hello Ian Thanks for answer but my question is

int x_angle=45,11,22,33,44,55,66,77,88,99;
https://datadrop.wolframcloud.com/api/v1.0/Add?bin=ID&x_angle

I am reading data from sensor so I need to send these data. In here, x_angle is a variable so it can change. I have 10 different vaules so I need to send step by step. If you want to send data &x_angle=45 or &45 like this ok but How can I send variables? Because I am using stm32f with telit Gprs module. Thanks Ugur

POSTED BY: ismail dundar

Hi Ugur,

I'm not sure what programming environment you're using, but if you need to send more than one value for the piece of data, you just make another request. For example, in C you can use something like snprintf_s to make the url using the current value of the variable, then later on change it again.

char buffer[100] = {0};
for(...)
{
    int x_angle = getData();
    sprintf(buffer,100,"https://datadrop.wolframcloud.com/api/v1.0/Add?bin=ID&x_angle=%d",x_angle);
    //make request using buffer
}

There are of course other ways to do this depending on what programming language / environment you're using.

Thanks,

Ian

POSTED BY: Ian Johnson
Posted 7 years ago

Thank you, Ian

It worked it was so helpful :)

  char buffer[100] 
    int x_angle = getData();
    sprintf(buffer,"https://datadrop.wolframcloud.com/api/v1.0/Add?bin=ID&x_angle=%d",x_angle);
  send(buffer);  //make request using buffer

Thanks

Ugur

POSTED BY: ismail dundar

Hi,

The URL interface uses REST parameters that use a key value system. So if you want to have the value 45 associated with x_angle, you can make the following request:

https://datadrop.wolframcloud.com/api/v1.0/Add?bin=ID&x_angle=45

Hope this helps. You can read more about REST parameters and how they're specified here : http://www.wolfram.com/datadrop/quick-reference/web-api/

Thanks,

Ian

POSTED BY: Ian Johnson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract