# \[SOLVED\]Control LEDs over the 'net - ERROR - "ok": false, "error": "Variable not found"

**URL:** <https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390>\
**Category:** Troubleshooting\
**Created:** [August 14, 2015, 1:58pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390 "2015-08-14T13:58:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 1:58pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/1 "2015-08-14T13:58:52Z")

</div>

Hi All,

I got stuck with the example code ([Control LEDs over the 'net](https://docs.particle.io/guide/getting-started/examples/photon/#control-leds-over-the-39-net)).  
I have tried many things over the last 24 hours but still no results.

Here’s a overview of the problems I have encountered:

**1. HTML file doesn’t load the form but shows just the plain text.**  
Yes, I did add my own ID and Token taken from the Build section  
Many times indeed. Also after reset Token, And restart to factory settings.

**2. When copying the API into the browser I get the following error:**

## { “ok”: false, “error”: “Variable not found” }

Any help, tips or tricks would be much appropriated.  
Thanks

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 14, 2015, 2:09pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/2 "2015-08-14T14:09:22Z")

</div>

Copying this definitely worked for me:

```auto
<html>
  <body>
  <center>
  <br>
  <br>
  <br>
  <form action="https://api.particle.io/v1/devices/your-device-ID-goes-here/led?access_token=your-access-token-goes-here" method="POST">
    Tell your device what to do!<br>
    <br>
    <input type="radio" name="args" value="on">Turn the LED on.
    <br>
    <input type="radio" name="args" value="off">Turn the LED off.
    <br>
    <br>
    <input type="submit" value="Do it!">
  </form>
  </center>
  </body>
</html>

```

> [@jaapdemaat](#):
>
> 1. When copying the API into the browser I get the following error:

What API exactly did you copy into the browser? This stuff?

```auto
curl https://api.particle.io/v1/devices/0123456789abcdef/led \
  -d access_token=123412341234 \
  -d params=on

```

If so, then yes, that doesn't work. To trigger functions you'd need to make a POST request, whereas your browser normally only makes GET requests. That's why it's reporting it didn't find a variable, since those use the GET requests with the same syntax.

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 2:17pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/3 "2015-08-14T14:17:27Z")

</div>

Hi Moors,  
Thanks for your reply.  
And that from another Limburger!!

Tried it again, same (no) result.

I’ve copied the API address from within this piece of code (after ,form action=") into the browser.  
With my personal ID and token. Again same (no) results.

Any other suggestions I should look at?

Im sure at one point you will ask me about my copy paste skills with regards to my ID and Token but Im sure I got that part sorted!

Thanks

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 14, 2015, 2:22pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/4 "2015-08-14T14:22:20Z")

</div>

> [@jaapdemaat](#):
>
> Hi Moors,Thanks for your reply.And that from another Limburger!!

It's a small world 😉

When you say "no result", what exactly do you mean? Is the website displaying something incorrectly, or do are you not able to toggle the LED?  
Do you see this at least?

> [@jaapdemaat](#):
>
> I've copied the API address from within this piece of code (after ,form action=") into the browser.With my personal ID and token. Again same (no) results.

The same reason as above; you're doing a GET request whereas you should be making a POST request instead.

> [@jaapdemaat](#):
>
> Im sure at one point you will ask me about my copy paste skills with regards to my ID and Token but Im sure I got that part sorted!

we'll get to that in a bit, don't worry 😜

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [August 14, 2015, 2:23pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/5 "2015-08-14T14:23:06Z")

</div>

> [@jaapdemaat](#):
>
> I've copied the API address from within this piece of code (after ,form action=") into the browser.With my personal ID and token. Again same (no) results.

Hi @jaapdemaat

You can't POST in a browser by just typing in a URL--it doesn't work that way.

You can POST from curl using the right syntax or you can POST from a web page form with a form action or by using AJAX, but not by typing or cutting and pasting into the URL box.

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 2:27pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/6 "2015-08-14T14:27:07Z")

</div>

Yes small world indeed!

The browser simple slows the code itself (like in a text editor) and doesn’t load the form as you showed me above.  
Which of course results into not being able to toggle the LED.

I guess we’re going into the copy paste aspect of my skills… 😁

Thanks,  
ps: Can I see your singing Tesla Coil anywhere online? Sounds amazing!

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 2:30pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/7 "2015-08-14T14:30:50Z")

</div>

Hi @bko  
Thanks for your reply but as I got rather desperate last night and start trying everything 😄  
Im aware that this isn’t the way forward. The issue is within the html code as it doesnt load proper in the browser.  
thanks, j

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 14, 2015, 2:33pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/8 "2015-08-14T14:33:22Z")

</div>

> [@jaapdemaat](#):
>
> I guess we're going into the copy paste aspect of my skills...

Sounds like it. Could you use the code I posted above, put that into a text file, swap the credentials, and then make sure to save it as a `.html` file?  
There's no reason why it shouldn't work, other than human error or a crappy browser.

In regards to the Tesla coil, yup you can over [here](http://jordymoors.nl/photo/#!Albums).

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 14, 2015, 2:38pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/11 "2015-08-14T14:38:58Z")

</div>

Hmm, you might not want to put your credentials out in the open like that. PM them next time if you want me to take a look at them.

Seeing as you’re using oSX, would you mind trying a different text editor, this might have something to do with it: [http://stackoverflow.com/questions/14439513/browser-shows-plain-text-instead-of-html-in-mac](http://stackoverflow.com/questions/14439513/browser-shows-plain-text-instead-of-html-in-mac)

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 2:42pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/12 "2015-08-14T14:42:44Z")

</div>

@Moors7

Thanks, have deleted the Post, thought it wouldn’t be a massive issue if I change my Access token later.  
New here so I couldnt find PM anywhere.

Will have a look at the osx text edit issue and let you know if it would solve the it.  
thanks

---

<div class="post-metadata">

**Author:** ![jaapdemaat](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jaapdemaat/32/6463_2.png) [@jaapdemaat](https://community.particle.io/u/jaapdemaat)\
**Post date:** [August 14, 2015, 2:56pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/13 "2015-08-14T14:56:11Z")

</div>

**BINGO!!!**

Problem: OSX Textedit software.  
Instead used: [TextWranger](http://www.barebones.com/products/textwrangler/) (which is free)

Someone at Particle should update the Guide as Im sure other people will have the same problem.

@Moors7 You are a star!  
Thank so much for helping.  
Next time Im in Limburg I buy you a drink!

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 14, 2015, 3:11pm UTC](https://community.particle.io/t/solved-control-leds-over-the-net-error-ok-false-error-variable-not-found/14390/14 "2015-08-14T15:11:38Z")

</div>

Glad to hear you’ve got it working!

OSX always messes things up… 😉 Still better than Windows though… :’(

Let me/us know if you’ve got any further issues, and we’ll see what we can do to help out.
