Error message couldn't resolve host access_token

I have my spark core attached to the Cloud and have installed CLI on my laptop which is connected to same wifi, generated Access code and it returns expected value for one of my simple projects (which returns temperature).

Now I want to access the connected spark from a remote location but it gives me following error message

curl -G https://api.spark.io/v1/devices/mydeviceid /Temperature_ -d access_token=******

Error message “couldn’t resolve host access_token=******”

Does this mean I cannot access the core from another terminal which is outside my local network with the given access token? Please suggest!!

Hi @lkhosla

You are replacing “mydeviceid” with the hex number for your device, right?

This should list all your cloud connected cores with their names and if they are connected:

curl https://api.spark.io/v1/devices/?access_token=****hex digits here***

Then you can cut and paste the id field after the devices part of the URL:

curl https://api.spark.io/v1/devices/<<hex device id here>>?access_token=****hex digits here***

to see the variables and functions you have programmed into your core.

1 Like

thanks but I think I did not explain the issue well :smile:

Basically I want to give access to the core to other folks in the family who maybe remote so that they can look at temperature for example. Is that possible?

Yes, you can look at cloud connected cores from anywhere on the Internet. I have checked the temperature of my office from a thousand miles away, no problem.

One other point–does your variable really have an underscore ("_") in the name? That is unusual.

1 Like

thanks, yes it does have _ and it works fine.

So you are suggesting I should be able to run the curl command on any system which has curl installed?

I can get the reading on my local system where the core is attached to via USB but when I give the same command to someone who is remote, they are getting the error message I mentioned above, Any suggestions?

on my local computer, works fine but same command on a remote system doesn’t

curl -G https://api.spark.io/v1/devices/hex/Temperature_ -d access_token=hex
{
“cmd”: “VarReturn”,
“name”: “Temperature_”,
“result”: “25.186813”,
“coreInfo”: {
“last_app”: “”,
“last_heard”: “2014-07-21T17:09:19.418Z”,
“connected”: true,
“deviceID”: “55ff77065075555356481787”
}

Hi @lkhosla

Hmmm… does this curl command work for you? On both computers?
curl -H “Authorization: Bearer your_access_token” https://api.spark.io/v1/devices/your_deviceID/Temperature_

Hi @lkhosla,

Just to check, your url in your first example has a space in it " ", that is breaking it into two urls, which is why you’re getting “couldn’t resolve host access_token=…”. Curl thinks you’re giving it two urls, instead of just one. :slight_smile:

Thanks,
David

Well, that space isn’t there in actual command but I tried to hide the device id and access_token and during that process I put in space here in the post.

Is there a way I can send you a private email with full command which includes device id and access code and you can try it for yourself on your terminal?

Thanks Elijah, your command worked fine with -H but not the -G which is what is suggested on most of the forums. Wondering whats the reason