This document is for a deprecated version of kpi's API.

Please upgrade to latest release /api/v2/assets/<code>{asset_uid}</code>/exports

List of export tasks endpoints

Lists the export tasks accessible to requesting user, for anonymous access nothing is returned.

Required permissions: view_submissions (View submissions)

GET /exports/

Examples

  curl -X GET https://[kpi]/exports/

List can be filtered through the following methods:

  • Source URL or UID if q=source:[URL|UID];
  • Comma-separated list of ExportTask UIDs if q=uid__in:[UID],[UID],... was provided
  • Data source URL if q=data__source:[URL]

Examples:

Exports from source asset uid is aSAvYreNzVEkrWg5Gdcvg

 curl -X GET https://[kpi]/exports/?q=data__source:https://[kpi]/api/v2/assets/aSAvYreNzVEkrWg5Gdcvg

Or

 curl -X GET https://[kpi]/exports/?q=source:aSAvYreNzVEkrWg5Gdcvg

Exports matching uids

 curl -X GET https://[kpi]/exports/?q=uid__in:ehZUwRctkhp9QfJgvEWGg,ehZUwRctkhp9QfJgvDnjud

CRUD

uid - is the unique identifier of a specific export task

Creates an export task

POST /exports/

Example

  curl -X POST https://[kpi]/exports/

Payload

   {
      "source": "https://[kpi]/api/v2/assets/aeztFxgduFxPTefFfYhfN7/",
      "fields_from_all_versions": "true",
      "group_sep": "/",
      "hierarchy_in_labels": "true",
      "lang": "English (en)",
      "multiple_select": "both",
      "type": "geojson",
      "fields": ["field_1", "field_2"],
      "flatten": "true"
   }

where:

  • "source" (required) is the URL of the source asset that contains the intended submissions for export
  • "fields_from_all_versions" (required) is a boolean to specify whether fields from all form versions will be included in the export.
  • "group_sep" (required) is a value used to separate the names in a hierarchy of groups. Valid inputs include:
    • Non-empty value
  • "hierarchy_in_labels" (required) is a boolean to specify whether the group hierarchy will be displayed in labels
  • "multiple_select" (required) is a value to specify the display of multiple_select-type responses. Valid inputs include:
    • "both",
    • "summary", or
    • "details"
  • "type" (required) specifies the export format. Valid export formats include:
    • "csv",
    • "geojson",
    • "spss_labels", or
    • "xls"
  • "fields" (optional) is an array of column names to be included in the export (including their group hierarchy). Valid inputs include:
    • An array containing any string value that matches the XML column name
    • An empty array which will result in all columns being included
    • If "fields" is not included in the "export_settings", all columns will be included in the export
  • "flatten" (optional) is a boolean value and only relevant when exporting to "geojson" format.

Retrieves current export task

GET /exports/{uid}/

Example

  curl -X GET https://[kpi]/exports/ehZUwRctkop9QfJgvDmkdh/

Deletes current export task

DELETE /exports/{uid}/

Example

  curl -X DELETE https://[kpi]/exports/ehZUwRctkop9QfJgvDmkdh/

CURRENT ENDPOINT

GET /exports/?format=api
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "count": 0,
    "next": null,
    "previous": null,
    "results": []
}