Making API call from Windows 7 64bit

From the “Annotated examples” I want to “control LEDs over the net” but I dont know how to make API call using my windows7 64bit system. I downloaded cURL for Windows 64 bit ( and placed it in c:\windows\systems32. Now I am able to use cURL commands from the command line. I actually like to use batch files so I created a text file and renamed it to *.bat. In the batch file I placed following text

curl<my_device_id>/led -d access_token=<my_token> -d params=l1,HIGH"

but the command doesn’t work and I get a SSL certificate check error. I was able to control the LEDs correctly using this handy webpage

Can anyone advise?

I got it working. First of all the format of the curl command is:

curl [options] <URL>

And you need to turn of the certification checking using the -k option.

curl -k -d params=l1,HIGH -d access_token=<my_token><my_device_id>/led

1 Like

Thanks @jrsikken for sharing the fix! We’ll update the documentation to include the -k flag.

Hi, thanks for the tips. I got my access_token and sent that along as a parameter, but then when I try to use curl to POST to my device I get a string of html for a 502 Bad Gateway page. Any ideas on what I’m doing wrong?

@Elijah can you share the curl request that you’re making? just obscure the device ID and access token.

curl -k -d pin=D7 -d level=HIGH -d access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[device_id]

and also

curl -k -d pin=D7 -d level=HIGH -d access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx[device_id]/led

@Elijah not sure if this is causing your problem, but you should only send in one data field. for example:

curl \
  -d access_token=1234123412341234123412341234123412341234 \
  -d params=l1,HIGH

No, passing -d params=D7,HIGH instead of -d pin=D7 -d level=HIGH is returning the same 502 error page html.

Oh I see the issue - you’re using instead of This is from our old pre-launch servers.

1 Like

OK, so now I am getting back a set of return values: name, id, last_app, connected, return_value but they don’t seem to depend on what I post with params; and the LED isn’t turned on.

It’s alright, it’s late, I’ll have to look into it more later =]

1 Like