Struggling with REST_Synchronization_API

Hi,

I have setup the Aggregate server on Google apps

Enabled ODK Tables Syncronization Functionality

Have operational example forms working on my phone and uploading data to
the site (all works great)

I need to be able to download the form data as XML from the Aggregate
server programmatically

so I'm assuming the REST functionality is built into version v1.4.4

I've gone through the spec doc on
https://code.google.com/p/opendatakit/wiki/REST_Synchronization_API

In the first instance I'm just looking to talk to the REST service using
some of the simpler commands

implemented with GET by pasting the URL into the browser.

I've also installed the Advanced REST client on CHROME and tried some post
/ get commands.

The problem is I'm not quite sure from reading the spec

What a practical URL for one of these commands would look like (I've tried
quite a few combinations also tried sending UID and password parameters
with the request)

I would really appreciate it if someone could post a practical example to
get me started (I could probably figure out the rest from the Doc )

Thanks,

John

Be advised that this spec is updated periodically to match the development
tip (uiexperiment).

It may therefore work slightly differently in the 1.4.4 release.

Because of authentication, when working to understand the interface, it is
best to grant the anonymous user Synchronize Tables or Adminster Tables
privileges.

This will eliminate any problems related to authentication. Note that you
can use several means of authentication once you get the base API
interactions worked out.

··· ---------------------------

There is a slick Chrome extension, "Advanced Rest Client" that is very
helpful when working with REST APIs.

Requests to the server should specify an Accept header. Communications are
either in json(preferred) or XML (should work, but not really tested).
i.e.,

Accept: application/json

The opendatakit-simpledemo server has anonymous Synchronize Tables
privileges, so you can issue this request:

https://opendatakit-simpledemo.appspot.com/odktables/tables/tables

To get the list of tables (just one) on that server. (the base of the REST
api is 'odktables', the appId on the server is 'tables', and you are
requesting the list of all 'tables' on the server). This corresponds to
this API

http://code.google.com/p/opendatakit/wiki/REST_Synchronization_API#List_All_Table_Resources_API

I.e.,

@GET
@Path("{appId}/tables")

https://opendatakit-simpledemo.appspot.com/odktables/tables/tables

                                                 ^{appId} ^/tables

On Sun, Oct 12, 2014 at 9:43 AM, John Gillen gillenjpm@googlemail.com wrote:

Hi,

I have setup the Aggregate server on Google apps

Enabled ODK Tables Syncronization Functionality

Have operational example forms working on my phone and uploading data to
the site (all works great)

I need to be able to download the form data as XML from the Aggregate
server programmatically

so I'm assuming the REST functionality is built into version v1.4.4

I've gone through the spec doc on
https://code.google.com/p/opendatakit/wiki/REST_Synchronization_API

In the first instance I'm just looking to talk to the REST service using
some of the simpler commands

implemented with GET by pasting the URL into the browser.

I've also installed the Advanced REST client on CHROME and tried some post
/ get commands.

The problem is I'm not quite sure from reading the spec

What a practical URL for one of these commands would look like (I've
tried quite a few combinations also tried sending UID and password
parameters with the request)

I would really appreciate it if someone could post a practical example to
get me started (I could probably figure out the rest from the Doc )

Thanks,

John

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

... and if you use the Chrome extension, be advised that you will get a 304
(not changed) error every other time you use the API.

This is because Chrome remembers ETag headers on the server's responses and
adds If-Modified headers even if you don't specify them.

··· On Mon, Oct 13, 2014 at 10:28 AM, Mitch Sundt wrote:

Be advised that this spec is updated periodically to match the development
tip (uiexperiment).

It may therefore work slightly differently in the 1.4.4 release.

Because of authentication, when working to understand the interface, it is
best to grant the anonymous user Synchronize Tables or Adminster Tables
privileges.

This will eliminate any problems related to authentication. Note that you
can use several means of authentication once you get the base API
interactions worked out.


There is a slick Chrome extension, "Advanced Rest Client" that is very
helpful when working with REST APIs.

Requests to the server should specify an Accept header. Communications are
either in json(preferred) or XML (should work, but not really tested).
i.e.,

Accept: application/json

The opendatakit-simpledemo server has anonymous Synchronize Tables
privileges, so you can issue this request:

https://opendatakit-simpledemo.appspot.com/odktables/tables/tables

To get the list of tables (just one) on that server. (the base of the REST
api is 'odktables', the appId on the server is 'tables', and you are
requesting the list of all 'tables' on the server). This corresponds to
this API

http://code.google.com/p/opendatakit/wiki/REST_Synchronization_API#List_All_Table_Resources_API

I.e.,

@GET
@Path("{appId}/tables")

https://opendatakit-simpledemo.appspot.com/odktables/tables/tables

                                                 ^{appId} ^/tables

On Sun, Oct 12, 2014 at 9:43 AM, John Gillen gillenjpm@googlemail.com wrote:

Hi,

I have setup the Aggregate server on Google apps

Enabled ODK Tables Syncronization Functionality

Have operational example forms working on my phone and uploading data to
the site (all works great)

I need to be able to download the form data as XML from the Aggregate
server programmatically

so I'm assuming the REST functionality is built into version v1.4.4

I've gone through the spec doc on
https://code.google.com/p/opendatakit/wiki/REST_Synchronization_API

In the first instance I'm just looking to talk to the REST service using
some of the simpler commands

implemented with GET by pasting the URL into the browser.

I've also installed the Advanced REST client on CHROME and tried some
post / get commands.

The problem is I'm not quite sure from reading the spec

What a practical URL for one of these commands would look like (I've
tried quite a few combinations also tried sending UID and password
parameters with the request)

I would really appreciate it if someone could post a practical example to
get me started (I could probably figure out the rest from the Doc )

Thanks,

John

--
You received this message because you are subscribed to the Google Groups
"ODK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com