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

Please upgrade to latest release /api/v2/assets/

  • Assign a asset to a collection partially implemented
  • Run a partial update of a asset TODO

TODO Complete documentation

List of asset endpoints

Lists the asset endpoints accessible to requesting user, for anonymous access a list of public data endpoints is returned.

GET /assets/

Example

  curl -X GET https://[kpi-url]/assets/

Get a hash of all version_ids of assets. Useful to detect any changes in assets with only one call to API

GET /assets/hash/

Example

  curl -X GET https://[kpi-url]/assets/hash/

CRUD

  • uid - is the unique identifier of a specific asset

Retrieves current asset

GET /assets/{uid}/

Example

  curl -X GET https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/

Creates or clones an asset.

POST /assets/

Example

  curl -X POST https://[kpi-url]/assets/

Payload to create a new asset

   {
      "name": {string},
      "settings": {
          "description": {string},
          "sector": {string},
          "country": {string},
          "share-metadata": {boolean}
      },
      "asset_type": {string}
   }

Payload to clone an asset

  {
      "clone_from": {string},
      "name": {string},
      "asset_type": {string}
  }

where asset_type must be one of these values:

  • block (can be cloned to block, question, survey, template)
  • question (can be cloned to question, survey, template)
  • survey (can be cloned to block, question, survey, template)
  • template (can be cloned to survey, template)

Settings are cloned only when type of assets are survey or template. In that case, share-metadata is not preserved.

When creating a new block or question asset, settings are not saved either.

Deployment

Retrieves the existing deployment, if any.

GET /assets/{uid}/deployment

Example

  curl -X GET https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/deployment

Creates a new deployment, but only if a deployment does not exist already.

POST /assets/{uid}/deployment

Example

  curl -X POST https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/deployment

Updates the active field of the existing deployment.

PATCH /assets/{uid}/deployment

Example

  curl -X PATCH https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/deployment

Overwrites the entire deployment, including the form contents, but does not change the deployment's identifier

PUT /assets/{uid}/deployment

Example

  curl -X PUT https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/deployment

Permissions

Updates permissions of the specific asset

PATCH /assets/{uid}/permissions

Example

  curl -X PATCH https://[kpi-url]/assets/aSAvYreNzVEkrWg5Gdcvg/permissions

CURRENT ENDPOINT

GET /assets/?ordering=-subscribers_count
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

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