Connect directly to a Spark Photon REST API

I connected my newly arrived Photon’s to my WIFI accespoint and followed the tutorials. I created the REST example from Which is working fine with the following URL:

However I would like to connect directly to the Photon without an internet connection. So something like http://PHOTON_HOSTNAME/… I searched through the community and found this thread: Tutorial: Local Cloud 1st Time instructions [01 Oct 15] . Is that the solution for my problem? Or is there an easier solution?

The local cloud should work. TCP/IP and UDP are also available. The local cloud should be the easiest transition though, depending on what you’re trying to achieve,

Ok, I just want to call a REST endpoint on the Photon to turn some LED’s on or off. So there is no way to directly call the Photon for instance with an IP address? It’s necessary to use the local cloud option?

Hi @johan, you don’t need the local cloud to implement a HTTP server on the photon. All that’s needed is a WiFi connection to a router.

In coming months we will implement AP mode on the photon, so the Photon itself will be the access point and your devices can connect directly to it without needing an intervening router.

Cheers :smile:

1 Like

I’ve setup the localcloud and I can see my Photon (actually the spark-server app mentions “Core online!” :)).

However I can’t connect to the Photon. I have uploaded the led example to the Photon. It works when I use the Particle cloud, but how do I connect to the Photon with the local cloud?

What URL should I use instead of the URL for the Particle cloud: ‘’?

Ok, I’m a bit further, apparently there is something wrong with my access token. But I have no idea what.

I figured out my acces token:

$ particle config identify
Current profile: localcloud_profile
Using API:
Access token: XYZ

I start ‘node main.js’ and in another window call the API:

$ curl
  "code": 400,
  "error": "invalid_grant",
  "error_description": "The access token provided is invalid."

The output of the local server is:

Your server IP address is:
server started { host: 'localhost', port: 5683 }
Connection from:, connId: 1
on ready { coreID: 'ABC',
  ip: '',
  product_id: 6,
  firmware_version: 65535,
  cache_key: '_0' }
Core online! - - [Wed, 16 Sep 2015 17:50:19 GMT] "GET /v1/devices?access_token=XYZ HTTP/1.1" 400 109 "-" "curl/7.30.0"

Any idea what I’m doing wrong?

Nah, your accesstoken is perfectly fine. For the Particle Cloud. Since you’re running the local cloud, you shouldn’t be using that one though.

Have a read through these topics:

1 Like

Thanks for the tip, but I already followed those tutorials. However I repeated some of the steps and now it’s working. Apparently I forget one or more of the steps. It would be nice if there was a simpler setup without so many steps :).

1 Like