Sugar Network/API: Difference between revisions

Line 9: Line 9:
The API is [[Wikipedia:Restful|RESTful]] and being served via HTTP(S) using [[Wikipedia:Json|JSON]] notation. The common RESTful request url format is:
The API is [[Wikipedia:Restful|RESTful]] and being served via HTTP(S) using [[Wikipedia:Json|JSON]] notation. The common RESTful request url format is:


  http[s]://<SERVER>[/<RESOURCE>[/<GUID>[/<PROPERTY>]]][?[cmd=<COMMAND>][&<ARGUMENT>=<VALUE>..]]
  http[s]://''SERVER''[/''RESOURCE''[/''GUID''[/''PROPERTY'']]][?[cmd=''COMMAND''][&''ARGUMENT''=''VALUE''..]]


When:
When:
Line 20: Line 20:
* {{Code|ARGUMENT}}s and {{Code|VALUE}}s depend on particular [[#Actions|action]].
* {{Code|ARGUMENT}}s and {{Code|VALUE}}s depend on particular [[#Actions|action]].


If request needs to send data, it should send Python dictionary converted to [[Wikipedia:Json|JSON]] notation.
In [[#Common_actions|most cases]], server replies in JSON notation. If request was failed, the replied JSON object will contain {{Code|request}} key, with original request, and {{Code|error}} key, with error message.
 
In [[#Common_actions|most cases]], server replies with dictionary in JSON notation. If request was failed, the replied dictionary will contain {{Code|request}}, with original request, and {{Code|error}}, with error message, keys. In the rest of cases, response might be variable.


== API servers ==
== API servers ==