Exports a single form to an XLSX or delimited text file.
NOTE: Supported export file formats (set by descriptor.format
) are limited to:
XLSX
CSV
TEXT
Starting the job
This operation is a long-running batch job. You must first submit a request to start the job.
POST https://www.activityinfo.org/resources/jobs
Request body
object | |||
type | string | The type of the job to start. Must be "exportForm" |
required |
descriptor | object | required | |
tableModels | array[object] | required | |
formId | string | The id of the form from which the table should be created. | required |
columns | array[object] | A list of columns to include in the table. If the list is empty, a list of columns will be computed from the form's fields. | required |
id | string | The id of the column. This is used to identify the column in the result. | required |
label | string | The text to use as the column's header. | optional |
formula | string | The formula used to compute this column's values. | required |
ordering | array[object] | List of columns to use in ordering the form's records. | required |
formula | string | required | |
ascending | boolean | required | |
filter | string | A boolean-valued formula which filters which records are included. | optional |
format | string | Values:
|
required |
utcOffset | integer | The time zone to use for time values, as an offset from Universal Coordinate Time (UTC) in minutes, | required |
Getting the job status
The result of this first call provides a job id that you can use to poll for status:
GET https://www.activityinfo.org/resources/jobs/{jobId}
curl -X GET https://www.activityinfo.org/resources/jobs/ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM \
-u anything:APITOKEN \
-H 'Content-type: application/json' \
--data-binary @- << EOF
{
"id": "ahBlfmFjdGl2aXR5aW5mb2V1chALEgNKb2IYgICAzd390wkM",
"state": "STARTED"
}
EOF
Successful result
When the job state transitions to "COMPLETED"
, the status object will include the result:
object | |||
id | string | The id of the job | required |
state | string | "COMPLETED" |
required |
result | object | required | |
filename | string | The filename of the export. | required |
downloadUrl | string | The URL that can be used to download the result. | required |