Modifications

Sauter à la navigation Sauter à la recherche
353 octets ajoutés ,  16 janvier 2015 à 15:45
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Spark.IO-Could-API-NAV}}
 
{{Spark.IO-Could-API-NAV}}
  −
{{traduction}}
      
== Enregistrer un CallBack ==
 
== Enregistrer un CallBack ==
   −
{{bloc-etroit|text=In the build section of the Spark website, you will be able to register a URL on your own server to which we will POST each time one of your Spark Cores publishes a certain event.  
+
{{bloc-etroit|text=Dans la section build du site web de Spark, vous serez capable d'enregistrer une URL vers votre propre serveur... une URL vers laquelle Spark effectuera un POST à chaque fois que votre Spark Cores publiera certain évènement.  
   −
{{ambox|text=This feature is still in progress, and will be released later in March.}}
+
{{ambox|text=Cette fonctionnalité est toujours en cours de développement et devrait être disponible courant Mars.}}
 
}}
 
}}
    
== Souscrire un événement ==
 
== Souscrire un événement ==
{{bloc-etroit|text=You can make an API call that will open a stream of [http://www.w3.org/TR/eventsource/ Server-Sent Events] (SSEs). You will make one API call that opens a connection to the Spark Cloud. That connection will stay open, unlike normal HTTP calls which end quickly. Very little data will come to you across the connection unless your Spark Core publishes an event, at which point you will be immediately notified.}}
+
{{bloc-etroit|text=Vous pouvez faire un appel d'API qui ouvre un flux (stream) de type [http://www.w3.org/TR/eventsource/ Server-Sent Events] (SSEs). Vous ferez un appel d'API qui ouvre une connexion vers Spark Cloud. Au contraire d'un appel HTTP normal qui ferme la connexion le plus rapidement possible, cette connexion SSE restera ouverte. Très peu d'information sera envoyé par cette connexion à moins que votre Spark Core ne publie un évènement, auquel cas vous serez immédiatement notifié.}}
   −
To subscribe to an event stream, make a GET request to one of the following endpoints. This will open a Server-Sent Events (SSE) stream, i.e., a TCP socket that stays open. In each case, the event name filter in the URI is optional. When specifying an event name filter, published events will be limited to those events with names that begin with the specified string. For example, specifying an event name filter of 'temp' will return events with names 'temp' and 'temperature'.  
+
Pour souscrire (''subscribe'') à un flux (''stream'') d’évènement, faite une requête GET sur un des points de contact suivant (''endpoint''). Cela ouvre un flux Server-Sent Events (SSE), par exemple, un socket TCP qui peu rester ouvert. Dans tous les cas, le nom de l’évènement à filtrer (dans l'URI) est optionnel. Lorsque vous spécifiez un filtre "nom d’évènement", les évènements publiés seront limités à ceux commençant par la chaine de caractère (celle spécifiée comme filtre). Par exemple, si vous spécifiez 'temp' comme filtre, vous recevrez les évènements ayant avec les noms 'temp' et 'temperature'.  
   −
SSE resources:
+
Ressources SSE:
 
* http://dev.w3.org/html5/eventsource/
 
* http://dev.w3.org/html5/eventsource/
 
* https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events
 
* https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events
 
* http://www.html5rocks.com/en/tutorials/eventsource/basics/
 
* http://www.html5rocks.com/en/tutorials/eventsource/basics/
   −
Subscribe to the firehose of public events, plus private events published by devices one owns:
+
Souscrire au flux des évènements publiques, plus les évènements privés publiés par vos Cores:
   −
  <nowiki>GET /v1/events[/:event_name]
+
  <nowiki>GET /v1/events[/:nom_evenement]
   −
# EXAMPLE
+
# EXEMPLE
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
https://api.spark.io/v1/events/temperature</nowiki>
 
https://api.spark.io/v1/events/temperature</nowiki>
   −
Subscribe to all events, public and private, published by devices one owns:
+
Souscrire à tous les évènement, publiques et privés, publiés par vos Cores:
   −
GET /v1/devices/events[/:event_name]
+
GET /v1/devices/events[/:nom_evenement]
   −
  <nowiki># EXAMPLE
+
  <nowiki># EXEMPLE
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
https://api.spark.io/v1/devices/events/temperature</nowiki>
 
https://api.spark.io/v1/devices/events/temperature</nowiki>
   −
Subscribe to events from one specific device. If the API user owns the device, then she will receive all events, public and private, published by that device. If the API user does not own the device she will only receive public events.
+
Souscrire aux événements d'un Core Spécifique. Si l'utilisateur de l'API possède le Core alors il recevra tous les évènements, publiques et privés, publié par le Core. Si l'utilisateur de l'API ne possède pas le Core il recevra uniquement les événements publiques.
   −
  <nowiki>GET /v1/devices/:device_id/events[/:event_name]
+
  <nowiki>GET /v1/devices/:core_id/events[/:nom_evenement]
   −
# EXAMPLE
+
# EXEMPLE
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
curl -H "Authorization: Bearer 38bb7b318cc6898c80317decb34525844bc9db55"
 
https://api.spark.io/v1/devices/55ff70064939494339432586/events/temperature</nowiki>
 
https://api.spark.io/v1/devices/55ff70064939494339432586/events/temperature</nowiki>
    
{{Spark.IO-Could-API-TRAILER}}
 
{{Spark.IO-Could-API-TRAILER}}
29 918

modifications

Menu de navigation