Ligne 2 : |
Ligne 2 : |
| | | |
| {{traduction}} | | {{traduction}} |
| + | |
| + | == introduction == |
| + | The Spark Cloud API is a [REST API] (dite "http://fr.wikipedia.org/wiki/Representational_State_Transfer REST API]", wikipedia.fr) . REST means a lot of things, but first and foremost it means that we use the URL in the way that it's intended: as a "Uniform Resource Locator". |
| + | |
| + | In this case, the unique "resource" in question is your Spark Core. Every Spark Core has a URL, which can be used to '''GET''' variables, '''POST''' a function call, or '''PUT''' new firmware. The variables and functions that you have written in your firmware are exposed as subresources within the Spark Core. |
| + | |
| + | All requests to the Spark Core come through our API server using TLS security. |
| + | |
| + | <nowiki>PROTOCOLE ET HOTE HOST |
| + | https://api.spark.io</nowiki> |
| + | |
| + | There are a number of API calls available, which are summarized here, and described in more detail below. |
| + | |
| + | List devices the currently authenticated user has access to. |
| + | |
| + | <nowiki>GET /v1/devices</nowiki> |
| + | |
| + | Get basic information about the given Core, including the custom variables and functions it has exposed. |
| + | |
| + | <nowiki>GET /v1/devices/{DEVICE_ID}</nowiki> |
| + | |
| + | Update the Core, including the display name or the firmware (either binary or source). |
| + | |
| + | <nowiki>PUT /v1/devices/{DEVICE_ID}</nowiki> |
| + | |
| + | Request the current value of a variable exposed by the core, e.g., ''GET /v1/devices/0123456789abcdef01234567/temperature'' |
| + | |
| + | <nowiki>GET /v1/devices/{DEVICE_ID}/{VARIABLE}</nowiki> |
| + | |
| + | Call a function exposed by the core, with arguments passed in request body, e.g., ''POST /v1/devices/0123456789abcdef01234567/brew'' |
| + | |
| + | <nowiki>POST /v1/devices/{DEVICE_ID}/{FUNCTION}</nowiki> |
| + | |
| + | Open a stream of [http://www.w3.org/TR/eventsource/ Server-Sent Events] <small>(''www.w3.org'')</small> |
| + | |
| + | <nowiki>GET /v1/events[/:event_name] |
| + | GET /v1/devices/events[/:event_name] |
| + | GET /v1/devices/{DEVICE_ID}/events[/:event_name]</nowiki> |
| | | |
| {{Spark.IO-Could-API-TRAILER}} | | {{Spark.IO-Could-API-TRAILER}} |