# Variable not found!

**URL:** <https://community.particle.io/t/variable-not-found/18617>\
**Category:** Troubleshooting\
**Created:** [December 29, 2015, 8:37am UTC](https://community.particle.io/t/variable-not-found/18617 "2015-12-29T08:37:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jackson\_lv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jackson_lv/32/8180_2.png) [@Jackson\_lv](https://community.particle.io/u/Jackson_lv)\
**Post date:** [December 29, 2015, 8:37am UTC](https://community.particle.io/t/variable-not-found/18617/1 "2015-12-29T08:37:22Z")

</div>

Hi Guys，I am using my Spark Photon to do some test.The setup code is as below

```auto
void setup()
{
  char addr[16];

  Serial.begin(115200);
  delay(2000)

  IPAddress localIP = WiFi.localIP();

  while (localIP[0] == 0)
  {
    localIP = WiFi.localIP();
    Serial.println("waiting for an IP address");
    delay(1000);
  }

  Serial.print(localIP[0], DEC);
  Serial.print('.');
  Serial.print(localIP[1], DEC);
  Serial.print('.');
  Serial.print(localIP[2], DEC);
  Serial.print('.');
  Serial.println(localIP[3], DEC);

  server.begin();

  //Setup the Tinker application here

  //Register all the Tinker functions

  Spark.variable("getjson",json_tx_string,STRING);
  Spark.function("digitalread", tinkerDigitalWrite);
  Spark.function("digitalwrite", tinkerDigitalWrite);
  Spark.function("analogread", tinkerAnalogRead);
  Spark.function("analogwrite", particleToDuo);

}

```

before I changed the variable key to “getjson” , it was “mess” and it will return the right message when I use the url [https://api.particle.io/v1/devices/xxx/mess?access\_token=xxx](https://api.particle.io/v1/devices/xxx/mess?access_token=xxx)

but after I changed it ,I got the message as{“ok”: false,“error”: “Variable not found”}when I used [https://api.particle.io/v1/devices/xxx/getjson?access\_token=xxx](https://api.particle.io/v1/devices/xxx/getjson?access_token=xxx)

even I changed the key back ,it couldn’t recover anymore. I just don’t know why!!!

---

<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:** [December 29, 2015, 8:53am UTC](https://community.particle.io/t/variable-not-found/18617/2 "2015-12-29T08:53:51Z")

</div>

Could you try putting the variables/functions at the top of the setup? Too long delays might cause them to not ‘take’.  
As a tool, you could use [this page](http://jordymoors.nl/interface) to check which functions/variables are available.

---

<div class="post-metadata">

**Author:** ![Jackson\_lv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jackson_lv/32/8180_2.png) [@Jackson\_lv](https://community.particle.io/u/Jackson_lv)\
**Post date:** [December 30, 2015, 8:33am UTC](https://community.particle.io/t/variable-not-found/18617/3 "2015-12-30T08:33:09Z")

</div>

I’ve tryed but it just not worked

---

<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:** [December 30, 2015, 1:22pm UTC](https://community.particle.io/t/variable-not-found/18617/4 "2015-12-30T13:22:09Z")

</div>

If you’ve got some code I can copy&paste, then I can test it.

---

<div class="post-metadata">

**Author:** ![Jackson\_lv](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jackson_lv/32/8180_2.png) [@Jackson\_lv](https://community.particle.io/u/Jackson_lv)\
**Post date:** [December 31, 2015, 6:37am UTC](https://community.particle.io/t/variable-not-found/18617/5 "2015-12-31T06:37:46Z")

</div>

the problem disappears now but I don’t know why, maybe is the cloud is unstable
