Enketo Logo
Hide allShow all

Response status codes

Success

Successes differ from errors in that their body may not be a simple response object with a code and a message. The headers however are consistent across all calls:

  • GET, POST returns 200 OK on success if the information was found,
  • POST returns 201 on success if a new database entry was created,
  • DELETE returns 204, without a body, if the entry was deleted

When retrieving stuff for example:

Status: 200 OK { "url": "https://enke.to/::abcd", "code": 200 }

Error

Error responses are returning standard HTTP error codes along with a descriptive message:

  • The error code is sent back as a status header,
  • The body includes an object describing both the code and message (for debugging and/or display purposes),

For a call with an invalid API key as username in the Authorization header for example:

Status: 401 Unauthorized { "code": 401, "message": "Access denied: invalid API key as username in the Authorization header."" }

400 401 403 404 405 410

Test Responses

Tests

The following parameters can (and should) be used to write tests for the Enketo API:

  • all tests all use API Token abc (or missing to test for errors),
  • form_id could be any string (or missing to test for errors),

Success responses

Use the following server_url parameter for success responses:

  • https://testserver.com/bob

Error responses

Use the following server_url parameters for error responses:

  • https://testserver.com/noquota to simulate insufficient quota
  • https://testserver.com/noapi to simulate no API access
  • https://testserver.com/noquotanoapi to simulate insufficient quota and no API access
  • https://testserver.com/notpaid to simulate an inactive account
  • https://testserver.com/notexist to simulate a non-existing server url or account with that server_url

GET /survey Get an online-only survey (existing)

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 this always returns an online-only survey.

In API v2 the defaults parameter was added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a url property if it exists (i.e. if it has been launched on enketo before with POST).

Status: 200 OK { "url": "https://enke.to/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/iframe Get an online-only iframe-able survey (existing)

This returns an online-only iframe-friendly survey.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 this returns a response with an iframe_url property.

In API v2 the defaults and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including the iframe_url property.

Status: 200 OK (if it already existed) { "iframe_url": "https://enke.to/i/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/offline Get an offline-capable survey (existing)

This returns an offline-capable survey.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

This endpoint is new in v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a url property if it exists (i.e. if it has been launched on enketo before with POST).

Status: 200 OK { "offline_url": "https://enke.to/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/single Get an online-only single-submit survey (existing)

This webform view will always redirect the user upon successful submission of a single record.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 the defaults parameter was added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_url property.

Status: 200 OK (if it already existed) { "single_url": "https://enke.to/single/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/single/iframe Get an online-only single-submit iframe-able survey (existing)

This webform view will always redirect the user upon successful submission of a single record.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 the defaults and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_iframe_url property.

Status: 200 OK (if it already existed) { "single_iframe_url": "https://enke.to/single/i/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/single/once Get an online-only single-submit survey that can be submitted once per user (new)

This webform view will always redirect the user upon successful submission of a single record. It has some basic protection to prevent the same user (browser & device) from submitting more than once.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_once_url property.

Status: 200 OK (if it already existed) { "single_once_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/single/once/iframe Get an online-only single-submit iframe-able survey that can be submitted once per user (existing)

This webform view will always redirect the user upon successful submission of a single record. It has some basic protection to prevent the same user (browser & device) from submitting more than once.

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_once_iframe_url property.

Status: 200 OK (if it already existed) { "single_once_iframe_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/preview Get a survey preview (existing)

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 the defaults parameter was added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a preview_url property which contains the enketo webform.

Status: 200 OK (if it already existed) { "preview_url": "https://enke.to/preview/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/preview/iframe Get an iframe-able survey preview (existing)

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

In API v2 the defaults parameter was added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a preview_url property.

Status: 200 OK (if it already existed) { "preview_iframe_url": "https://enke.to/preview/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /survey/all Get all survey views (existing)

The GET version of this endpoint is only meant to test the Enketo Smart Paper API in the browser. It does not launch new surveys and is therefore not of use for integrating with Enketo.

The response property names have changed in API v2.

In API v2 the defaults and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object with various properties.

Status: 200 OK (if it already existed) { "url": "https://enke.to/::abcd", "iframe_url": "https://enke.to/i/::abcd", "offline_url": "https://enke.to/_/#abcd", "single_url": "https://enke.to/single/::abcd", "single_iframe_url": "https://enke.to/single/i/::abcd", "single_once_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "single_once_iframe_url": "https://enke.to/single/i/::werdgag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::abcd", "preview_iframe_url": "https://enke.to/preview/i/::abcd", "enketo_id": "abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in browser

Enter API token as username when asked.

Try in terminal

POST /survey Get an online-only survey (new or existing)

In API v2 this always returns an online-only survey.

In API v2 the defaults and theme parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a url property.

Status: 200 OK (existing) Status: 201 OK (new) { "url": "https://enke.to/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/iframe Get an online-only iframe-able survey (new or existing)

This returns an online-only iframe-friendly survey.

In API v2 this returns a response with an iframe_url property.

In API v2 the theme, defaults, and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including the iframe_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "iframe_url": "https://enke.to/i/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/offline Get an offline-capable survey (new or existing)

This returns an offline-capable survey.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a url property.

Status: 200 OK (existing) Status: 201 OK (new) { "offline_url": "https://enke.to/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/single Get an online-only single-submit survey (new or existing)

This webform view will always redirect the user upon successful submission of a single record.

In API v2 the theme and defaults parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a single_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "single_url": "https://enke.to/single/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/single/iframe Get an online-only single-submit iframe-able survey (new or existing)

This webform view will always redirect the user upon successful submission of a single record.

In API v2 the theme, defaults, and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_iframe_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "single_iframe_url": "https://enke.to/single/i/::aberj32wrkjdgkajahg", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/single/once Get an online-only single-submit survey that can be submitted once per user (new or existing)

This webform view will always redirect the user upon successful submission of a single record. It has some basic protection to prevent the same user (browser & device) from submitting more than once.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_once_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "single_once_url": "https://enke.to/single/::abw3e325tt2gdsgsfd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/single/once/iframe Get an online-only single-submit iframe-able survey that can be submitted once per user (new or existing)

This webform view will always redirect the user upon successful submission of a single record. It has some basic protection to prevent the same user (browser & device) from submitting more than once.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including an single_once_iframe_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "single_once_iframe_url": "https://enke.to/single/::abw3e325tt2gdsgsfd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/preview Get a survey preview (new or existing)

In API v2 the theme and defaults parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a preview_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "preview_url": "https://enke.to/preview/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/preview/iframe Get an iframeable survey preview (new or existing)

In API v2 the theme and defaults parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a preview_url property.

Status: 200 OK (existing) Status: 201 OK (new) { "preview_iframe_url": "https://enke.to/preview/i/::abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

POST /survey/all Get all survey views (new or existing)

The response property names have changed in API v2.

In API v2 the theme, defaults, and parent_window_origin parameters were added.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • optional parameter theme can be used to centrally override the theme for all subsequent users, or to reset the theme with an emtpy string value
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • optional
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object with various properties.

Status: 200 OK (existing) Status: 201 OK (new) { "url": "https://enke.to/::abcd", "iframe_url": "https://enke.to/i/::abcd", "offline_url": "https://enke.to/_/#abcd", "single_url": "https://enke.to/single/::abcd", "single_iframe_url": "https://enke.to/single/i/::abcd", "single_once_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "single_once_iframe_url": "https://enke.to/single/i/::werdgag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::abcd", "preview_iframe_url": "https://enke.to/preview/i/::abcd", "enketo_id": "abcd", "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 405 410

Try in terminal

DELETE /survey De-activate a survey

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Status: 204 OK (found and de-activated) [EMPTY]

For error responses, see the response status codes documentation.

204 400 401 403 404 405 410

Try in terminal

DELETE /survey/cache Flush a survey cache

Remove the cached survey transformation results from Enketo. To be used when an already-launched XForm has been edited and is re-published. Highly recommended to use this only when necessary to avoid severe loading performance degradation.

This endpoint is new in API v2.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Status: 204 OK (found and flushed) [EMPTY]

For error responses, see the response status codes documentation.

204 400 401 403 404 405 410

Try in terminal

GET /surveys/number Get the number of launched surveys

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including the number property.

Status: 200 OK (existing) { "number": 12, "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 410

Try in browser

Enter API token as username when asked.

Try in terminal

GET /surveys/list Get the list of launched surveys

In API v2 the defaults and parent_window_origin parameters were added.

In API v2 the response properties have changed.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object with launched forms.

Status: 200 OK { "forms": [ { "server_url": "https://myserver.com/bob", "form_id": "widgets", "enketo_id": "abcd", "url": "https://enke.to/::abcd", "iframe_url": "https://enke.to/i/::abcd", "offline_url": "https://enke.to/_/#abcd", "single_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "single_iframe_url": "https://enke.to/single/i/::werdgag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::abcd", "preview_iframe_url": "https://enke.to/preview/i/::abcd", "enketo_id": "abcd" }, { "server_url": "https://myserver.com/bob", "form_id": "birds", "enketo_id": "efgh", "url": "https://enke.to/::efgh", "iframe_url": "https://enke.to/i/::efgh", "offline_url": "https://enke.to/_/#efgh", "single_url": "https://enke.to/single/::abcag3e423gsgadgsd", "single_iframe_url": "https://enke.to/single/i/::abcag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::efgh", "preview_iframe_url": "https://enke.to/preview/i/::efgh", "enketo_id": "efgh" } ], "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 410

Try in browser

Enter API token as username when asked.

Try in terminal

POST /surveys/number Get the number of launched surveys

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including the number property.

Status: 200 OK (existing) { "number": 12, "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 410

Try in terminal

POST /surveys/list Get the list of launched surveys

In API v2 the defaults and parent_window_origin parameters were added.

In API v2 the response properties have changed.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • optional parameter defaults[] can be used to dynamically override survey field defaults
  • optional parameter parent_window_origin can be used to safely enable an iframed survey to post messages back to the parent window
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object with launched forms.

Status: 200 OK { "forms": [ { "server_url": "https://myserver.com/bob", "form_id": "widgets", "enketo_id": "abcd", "url": "https://enke.to/::abcd", "iframe_url": "https://enke.to/i/::abcd", "offline_url": "https://enke.to/_/#abcd", "single_url": "https://enke.to/single/::werdgag3e423gsgadgsd", "single_iframe_url": "https://enke.to/single/i/::werdgag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::abcd", "preview_iframe_url": "https://enke.to/preview/i/::abcd", "enketo_id": "abcd" }, { "server_url": "https://myserver.com/bob", "form_id": "birds", "enketo_id": "efgh", "url": "https://enke.to/::efgh", "iframe_url": "https://enke.to/i/::efgh", "offline_url": "https://enke.to/_/#efgh", "single_url": "https://enke.to/single/::abcag3e423gsgadgsd", "single_iframe_url": "https://enke.to/single/i/::abcag3e423gsgadgsd", "preview_url": "https://enke.to/preview/::efgh", "preview_iframe_url": "https://enke.to/preview/i/::efgh", "enketo_id": "efgh" } ], "code": 200 }

For error responses, see the response status codes documentation.

200 400 401 403 404 410

Try in terminal

POST /instance Post an instance for editing

This webform view edits an existing already-submitted finalized record.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • required parameter instance is the XML instance with escaped quotation marks to be edited
  • required parameter instance_id is the instanceID of the existing record to be edited
  • optional parameter instance_attachments[] can be used to pass attachments for the instance to be edited
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a edit_url property. You should redirect the user to this temporary URL immediately. Nother that this method will never return a 200. To (somewhat) protect agains two persons editing the same instance simultaneously, the instance is saved only temporarily in enketo (1 minute max) and during this time, a subsequent request will return 405 Not Allowed.

Status: Status: 201 OK { "edit_url": "https://enke.to/edit/::abcd?instance_id=324sfasgsa324", "code": 201 }

For error responses, see the response status codes documentation.

201 400 401 403 404 405 410

Try in terminal

POST /instance/iframe Post an instance for editing (iframeable response)

This webform view edits an existing already-submitted finalized record.

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • required parameter instance is the XML instance with escaped quotation marks to be edited
  • required parameter instance_id is the instanceID of the existing record to be edited
  • optional parameter instance_attachments[] can be used to pass attachments for the instance to be edited
  • optional parameter return_url is the URL to redirect the user to after submission on single submit surveys (default is a generic thank you page)
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Sends back an object including a edit_url property. You should redirect the user to this temporary URL immediately. Nother that this method will never return a 200. To (somewhat) protect agains two persons editing the same instance simultaneously, the instance is saved only temporarily in enketo (1 minute max) and during this time, a subsequent request will return 405 Not Allowed.

Status: Status: 201 OK { "edit_url": "https://enke.to/edit/i/::abcd?instance_id=324sfasgsa324", "code": 201 }

For error responses, see the response status codes documentation.

201 400 401 403 404 405 410

Try in terminal

DELETE /instance Delete a temporary instance

This method may not have a practical use as instances POSTed to enketo for editing are only cached/saved very briefly (available for a maximum of 1 minute).

Request

The request Content-Type is application/x-www-form-urlencoded.

  • required parameter server_url is the url of the OpenRosa server your form is hosted on
  • required parameter form_id is the ID of the form listed in SERVER/formList
  • required parameter instance_id is the instanceID of the existing record to be edited
  • headers must include a valid API key as username in the Authorization header

Authorization: Basic API_KEY:

Response

Status: 204 OK (found and removed)


For error responses, see the response status codes documentation.

204 400 401 403 404 405 410

Try in terminal