# I am having trouble using Spark API

**URL:** https://community.particle.io/t/i-am-having-trouble-using-spark-api/914
**Category:** Troubleshooting
**Created:** [December 22, 2013, 1:46pm UTC](https://community.particle.io/t/i-am-having-trouble-using-spark-api/914 "2013-12-22T13:46:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pravios](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/pravios/32/21004_2.png) [@pravios](https://community.particle.io/u/pravios)
#### Post date: [December 22, 2013, 1:46pm UTC](https://community.particle.io/t/i-am-having-trouble-using-spark-api/914/1 "2013-12-22T13:46:47Z")

</div>

I am trying to implement the second example given in the Spark Examples “Connecting LED through internet”. For some reason, my curl command always fails in the Mac terminal. I have reset the token and added the new token every time and also made sure the core has the right id. But still it says the following.  
{  
“code”: 400,  
“error”: “invalid\_grant”,  
“error\_description”: “The access token provided has expired.”  
}curl: (6) Could not resolve host:

---

<div class="post-metadata">

### Author: ![amanfredi](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/amanfredi/32/2034_2.png) [@amanfredi](https://community.particle.io/u/amanfredi)
#### Post date: [December 23, 2013, 9:12pm UTC](https://community.particle.io/t/i-am-having-trouble-using-spark-api/914/2 "2013-12-23T21:12:17Z")

</div>

Can you paste the command you are running? The error at the end looks like your command isn’t formatted correctly. Make sure you put the URL in quotes.

curl “[http://example.com?foo=bar](http://example.com?foo=bar)”

---

<div class="post-metadata">

### Author: ![jgoggins](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jgoggins/32/20654_2.png) [@jgoggins](https://community.particle.io/u/jgoggins)
#### Post date: [December 23, 2013, 9:18pm UTC](https://community.particle.io/t/i-am-having-trouble-using-spark-api/914/3 "2013-12-23T21:18:22Z")

</div>

Good call @amanfredi , that has burned me too. Additionally, I’d recommend using single quotes instead of double and also quoting the other parameters as well like this:

```
curl 'https://api.spark.io/v1/devices/0123456789abcdef01234567/led' -d 'access_token=1234123412341234123412341234123412341234' -d 'params=l1,HIGH'

```

Single quotes are more restrictive than double quotes in terms of what gets interpolated in bash (the underlying program of the Mac Terminal)
