Skip to main content

kobotoolbox@3.0.1

getDeploymentInfo(formId)
getForms()
getSubmissions(formId, [options])

This adaptor exports the following namespaced functions:

http.get(path, [options])
http.post(path, data, [options])
http.put(path, data, [options])

This adaptor exports the following from common:

alterState()
cursor()
dataPath()
dataValue()
each()
field()
fields()
fn()
fnIf()
group()
http
lastReferenceValue()
merge()
sourceValue()

Functions

getDeploymentInfo

getDeploymentInfo(formId) ⇒ Operation

Get deployment information for a specific form. Calls /api/v2/assets/<id>/deployment/.

ParamTypeDescription
formIdstringForm Id to get the deployment information

This operation writes the following keys to state:

State KeyDescription
dataan object containing deployment information

Example

getDeploymentInfo('aXecHjmbATuF6iGFmvBLBX');

getForms

getForms() ⇒ Operation

Make a request to fetch all survey forms accessible to the authorized user. Calls /api/v2/assets/?asset_type=survey.

This operation writes the following keys to state:

State KeyDescription
dataan array of form objects

Example

getForms();

getSubmissions

getSubmissions(formId, [options]) ⇒ Operation

Get submissions for a specific form. Calls /api/v2/assets/<formId>/data/.

ParamTypeDefaultDescription
formIdstringForm Id to get the specific submissions
[options]object{}Optional query params for the request

This operation writes the following keys to state:

State KeyDescription
dataan array of submission objects

Example: Get all submissions for a specific form

getSubmissions('aXecHjmbATuF6iGFmvBLBX');

Example: Get form submissions with a query

getSubmissions('aXecHjmbATuF6iGFmvBLBX', { query: { _submission_time:{ $gte: "2022-06-12T21:54:20" } } });

http

These functions belong to the http namespace.

http.get

get(path, [options]) ⇒ operation

Make a GET request to any KoboToolbox endpoint.

ParamTypeDefaultDescription
pathstringpath to resource
[options]RequestOptions{}An object containing query params and headers for the request

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the KoboToolbox server (excluding the body). Responses will be returned in JSON format
referencesAn array of all previous data objects used in the Job

Example: GET assets resource

http.get(
"/assets/",
)

http.post

post(path, data, [options]) ⇒ operation

Make a POST request to a KoboToolbox endpoint

ParamTypeDefaultDescription
pathstringpath to resource
dataanythe body data in JSON format
[options]RequestOptions{}An object containing query params and headers for the request

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the KoboToolbox server (excluding the body). Responses will be returned in JSON format
referencesAn array of all previous data objects used in the Job

Example: Create an asset resource

http.post(
'/assets/',
{
name: 'Feedback Survey Test',
asset_type: 'survey',
},
);

http.put

put(path, data, [options]) ⇒ operation

Make a PUT request to a KoboToolbox endpoint

ParamTypeDefaultDescription
pathstringpath to resource
dataanythe body data in JSON format
[options]RequestOptions{}An object containing query params and headers for the request

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the KoboToolbox server (excluding the body). Responses will be returned in JSON format
referencesAn array of all previous data objects used in the Job

Example: Update an asset resource

http.put(
'assets/a4jAWzoa8SZWzZGhx84sB5/deployment/',
{
name: 'Feedback Survey Test',
asset_type: 'survey',
},
);

Interfaces

KoboToolboxHttpState

State object

Properties

NameDescription
dataThe response body (as JSON)
responseThe HTTP response from the KoboToolbox server (excluding the body). Responses will be returned in JSON format
referencesAn array of all previous data objects used in the Job

RequestOptions

Options object

Properties

NameTypeDefaultDescription
queryobjectAn object of query parameters to be encoded into the URL
headersobjectAn object of all request headers
[parseAs]string"'json'"The response format to parse (e.g., 'json', 'text', or 'stream')

RequestOptions

Options object

Properties

NameTypeDefaultDescription
queryobjectAn object of query parameters to be encoded into the URL
headersobjectAn object of all request headers
[parseAs]string"'json'"The response format to parse (e.g., 'json', 'text', or 'stream')