# Particle REST call slow or timed out

**URL:** <https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029>\
**Category:** Cloud\
**Created:** [April 12, 2016, 10:09am UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029 "2016-04-12T10:09:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barabba](https://avatars.discourse-cdn.com/v4/letter/b/258eb7/32.png) [@Barabba](https://community.particle.io/u/Barabba)\
**Post date:** [April 12, 2016, 10:09am UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029/1 "2016-04-12T10:09:03Z")

</div>

Hi guys,  
I’m trying to get variable and call functions from REST client (I’m using Postman, RestSharp on C# and cUrl too) but my Particle gives me timeout or results after 30+ seconds. A couple of months ago the same .ino works perfectly.

Suggestions?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 12, 2016, 3:55pm UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029/2 "2016-04-12T15:55:48Z")

</div>

The code might not have changed for you, but we still don't know what it looks like 😕

> [@Barabba](#):
>
> Suggestions?

Show code 🕶

---

<div class="post-metadata">

**Author:** ![Barabba](https://avatars.discourse-cdn.com/v4/letter/b/258eb7/32.png) [@Barabba](https://community.particle.io/u/Barabba)\
**Post date:** [April 12, 2016, 4:42pm UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029/3 "2016-04-12T16:42:53Z")

</div>

Here:

```
int photoresistor = A0; // This is where your photoresistor is plugged in. The other side goes to the "power" pin (below).

int power = A5; // This is the other end of your photoresistor. The other side is plugged into the "photoresistor" pin (above).
// The reason we have plugged one side into an analog pin instead of to "power" is because we want a very steady voltage to be sent to the photoresistor.
// That way, when we read the value from the other side of the photoresistor, we can accurately calculate a voltage drop.

int analogvalue; // Here we are declaring the integer variable analogvalue, which we will use later to store the value of the photoresistor.
int dummyValue;

// Next we go into the setup function.

void setup() {

    // First, declare all of our pins. This lets our device know which ones will be used for outputting voltage, and which ones will read incoming voltage.

    pinMode(A0,INPUT); // Our photoresistor pin is input (reading the photoresistor)
    pinMode(A5,OUTPUT); // The pin powering the photoresistor is output (sending out consistent power)

    // Next, write one pin of the photoresistor to be the maximum possible, so that we can use this for power.
    digitalWrite(A5,HIGH);

    // We are going to declare a Particle.variable() here so that we can access the value of the photoresistor from the cloud.
    Particle.variable("analogVal", &analogvalue, INT);
    Particle.variable("dummyVal", &dummyValue, INT);
    // This is saying that when we ask the cloud for "analogvalue", this will reference the variable analogvalue in this app, which is an integer variable.

    // We are also going to declare a Particle.function so that we can turn the LED on and off from the cloud.
    Particle.function("test",testFunction);
    Particle.function("dummyPublish",dummyPublishFunction);
    // This is saying that when we ask the cloud for the function "led", it will employ the function ledToggle() from this app.

}

// Next is the loop function...

void loop() {

    // check to see what the value of the photoresistor is and store it in the int variable analogvalue
    analogvalue = analogRead(photoresistor);
    delay(200);

}

int dummyPublishFunction(String arg){
    Particle.publish("Dummy","Nice and clean!");
    return 0;
}

int testFunction(String command) {

    if (command=="test") {
        return 42;
    }
    else {
        return -42;
    }
}
```

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 12, 2016, 5:14pm UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029/4 "2016-04-12T17:14:00Z")

</div>

There is nothing to see in your code that would cause the delay you see, and running on my device I can’t see that either, so there might be an issue with your connection or it was a temporary thing.

I’ve been testing with this  
[http://suda.github.io/particle-web-interface/](http://suda.github.io/particle-web-interface/)

---

<div class="post-metadata">

**Author:** ![Barabba](https://avatars.discourse-cdn.com/v4/letter/b/258eb7/32.png) [@Barabba](https://community.particle.io/u/Barabba)\
**Post date:** [April 18, 2016, 10:58am UTC](https://community.particle.io/t/particle-rest-call-slow-or-timed-out/22029/5 "2016-04-18T10:58:12Z")

</div>

Still slow…
