Read/Write a core's name?

How do you get a core’s name from the Cloud API?

Querying variable “name” doesn’t work and the coreInfo entity on other variables doesn’t contain it.
Also how do you set it through the API?

Api call without variable or function gives the name, but you have to parse it from JSON:
https://api.spark.io/v1/devices/xxxxxxxxxxxxxxx/?access_token=yyyyyyyyyyyyyy

{
  "id": "xxxxxxxxxxxxxxxxxxxxx",
  "name": "luigi",
  "variables": {},
  "functions": []
}
1 Like

Even returns all the available variables and functions. Nice!
Thanks for the quick reply.

1 Like

hmm. @weakset But how do I set the name through the API?

Actually I haven’t ever tried that direction before, but this seems to work:

curl -X PUT -F name=mario "https://api.spark.io/v1/devices/xxxxxxxxxx/?access_token=yyyyyyyyyyyyyy"

Adapted from firmware upload -example:
http://docs.spark.io/#/api/verifing-and-flashing-new-firmware-flash-a-core-with-source-code

2 Likes

Wow, how did I not see this yet?

Flash a Core with source code (aka send a source file to be compiled and flashed)

and just below that

Flash a Core with a pre-compiled binary

This is great for automatic field updates to systems using Spark Cores!