This document describes the procedure used to create a new binding for a SyncML phone to a new or existing datastore account.
The following REST endpoints can be used to access phone to datastore bindings.
| API | Endpoint | Supported Operations |
|---|---|---|
| Binding | http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/ | GET, POST |
This API is protected and need authentication. See OAuth documentation for details.
The following xml is used when registering or listing bindings between syncml and datastore:
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:oc="http://schemas.obexcode.com/syncserver/2009"> <id></id> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/187" rel="self" /> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/187" rel="alternate" type="text/html" /> <link href="http://api.obexcode.com/v2/services/syncml/b96afa84-a153-11de-aae5-002215064801" rel="syncml_client" type="application/atom+xml" /> <link href="http://api.obexcode.com/v2/services/datastore/fe6b3dae-7dc9-11de-8114-002215064801" rel="datastore_client" type="application/atom+xml" /> <oc:model_uuid></oc:model_uuid> <oc:phone_number></oc:phone_number> <oc:foreign_user_id></oc:foreign_user_id> <oc:timezone></oc:timezone> </entry>
The parameters are as follows:
Post the constructed Atom entry to the controller:
POST /v2/syncengine/phone_datastore_bindings HTTP/1.1 Host: api.obexcode.com Content-Type: application/atom+xml Accept: application/atom+xml Content-Length: ?? <entry xmlns="http://www.w3.org/2005/Atom" xmlns:oc="http://schemas.obexcode.com/syncserver/2009"> <oc:model_uuid>02978288-537f-102b-beff-000ea60275d1</oc:model_uuid> <oc:phone_number>+4799988877</oc:phone_number> <oc:foreign_user_id>my_user:1456</oc:foreign_user_id> <oc:timezone>Europe/Oslo</oc:timezone> </entry>
The response will be the newly created entry, with any automatic fields added.
HTTP/1.1 201 Created Date: Mon, 14 Sep 2009 17:26:23 GMT Content-Length: 1198 Content-Type: application/atom+xml Allow: GET, HEAD, POST Server: CherryPy/3.1.2 <entry xmlns="http://www.w3.org/2005/Atom"> <author> <name>test</name> <email>test@obexcode.com</email> </author> <id>http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/187</id> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/187" rel="self" /> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/187" rel="alternate" type="text/html" /> <link href="http://api.obexcode.com/v2/services/syncml/b96afa84-a153-11de-aae5-002215064801" rel="syncml_client" type="application/atom+xml" /> <link href="http://api.obexcode.com/v2/services/datastore/fe6b3dae-7dc9-11de-8114-002215064801" rel="datastore_client" type="application/atom+xml" /> <published>2009-09-14T19:26:23Z</published> <title>187</title> <updated>2009-09-14T19:26:23Z</updated> <foreign_user_id xmlns="http://schemas.obexcode.com/syncserver/2009">my_user:1456</foreign_user_id> <phone_number xmlns="http://schemas.obexcode.com/syncserver/2009">+4799988877</phone_number> <model_uuid xmlns="http://schemas.obexcode.com/syncserver/2009">02978288-537f-102b-beff-000ea60275d1</model_uuid> <timezone xmlns="http://schemas.obexcode.com/syncserver/2009">Europe/Oslo</timezone> </entry>
Here is a complete code example in Python.
Request:
GET /v2/syncengine/phone_datastore_bindings/ HTTP/1.1 Host: api.obexcode.com Accept: application/atom+xml
Response:
HTTP/1.1 200 Created Content-Type: application/atom+xml Content-Length: 2788 <feed xmlns="http://www.w3.org/2005/Atom"> <author> <name>ObexCode AS</name> </author> <id>http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/all.xml</id> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/all.xml" rel="self" /> <title>Phone datastore bindings</title> <entry> <author> <name>admin</name> <email>frank@obexcode.com</email> </author> <id>http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/5</id> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/5" rel="self" /> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/5" rel="alternate" type="text/html" /> <link href="http://api.obexcode.com/v2/services/syncml/2e3b9838-29bc-11de-a8bb-002215064801" rel="syncml_client" type="application/atom+xml" /> <link href="http://api.obexcode.com/v2/services/datastore/2e3be5a4-29bc-11de-a8bb-002215064801" rel="datastore_client" type="application/atom+xml" /> <published /> <title>5</title> <updated /> <foreign_user_id xmlns="http://schemas.obexcode.com/syncserver/2009">my_user:1456</foreign_user_id> <phone_number xmlns="http://schemas.obexcode.com/syncserver/2009">+4790066951</phone_number> <model_uuid xmlns="http://schemas.obexcode.com/syncserver/2009">2f0fd4a4-f113-11dd-a003-000e0cc4a82b</model_uuid> <timezone xmlns="http://schemas.obexcode.com/syncserver/2009">Europe/Oslo</timezone> </entry> <entry> <author> <name>admin</name> <email>frank@obexcode.com</email> </author> <id>http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/12</id> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/12" rel="self" /> <link href="http://api.obexcode.com/v2/syncengine/phone_datastore_bindings/12" rel="alternate" type="text/html" /> <link href="http://api.obexcode.com/v2/services/syncml/d0d68c44-29ba-11de-ae4e-002215064801" rel="syncml_client" type="application/atom+xml" /> <link href="http://api.obexcode.com/v2/services/datastore/bfb85fc8-30a9-11de-b930-002215064801" rel="datastore_client" type="application/atom+xml" /> <published /> <title>12</title> <updated /> <foreign_user_id xmlns="http://schemas.obexcode.com/syncserver/2009">jallalabba</foreign_user_id> <phone_number xmlns="http://schemas.obexcode.com/syncserver/2009">+4790066951</phone_number> <model_uuid xmlns="http://schemas.obexcode.com/syncserver/2009">2f0fd4a4-f113-11dd-a003-000e0cc4a82b</model_uuid> <timezone xmlns="http://schemas.obexcode.com/syncserver/2009">Europe/Oslo</timezone> </entry> </feed>