Geovisualization Developer's Guide

Recipes

Use this resource to upload, retrieve, update and delete recipes.

A recipe is a representation of how a raw data source matches a dataset in Geovisualization. The import process consists of two steps:
  • Create a recipe defining the source and details of your data source
  • Create a dataset based on the recipe

You can query the progress of uploading data using the datasets resource.

For more information on valid data formats, see Data Format Guidelines.

The table below summarizes the available endpoints supported by the recipes resource along with their HTTP methods and responses.

Table 1. Recipes Endpoints
Resource Functions Method Response
/recipes/{RECIPE_ID} Fetch a recipe definition GET 200 OK with a response object with the recipe ID
Delete a recipe DELETE 200 OK with a response object with the recipe ID
/recipes Create a recipe as defined in the request body. POST 201 Created and a response object with the recipe ID
/recipes

Specify an existing recipe ID in the request body to create a copy of that recipe with the same values.

POST 201 Created and a response object with the recipe ID
/recipes/{RECIPE_ID}/source Rewrite the recipe source value. You only need to send the source array of the request body. PUT 200 OK if successful and a response object for the new source
/recipes/{RECIPE_ID}/format Rewrite the recipe format value. You only need to send the format array of the request body. PUT 200 OK if successful and a response object for the new format
/recipes/{RECIPE_ID}/schema Rewrite the recipe schema value. You only need to send the schema object of the request body. PUT 200 OK if successful and a response object for the new schema

Examples

The example below contains a data source of wind farms with their location (as a lat/long pair), output capacity and their state.

{
  "source": {
  "url": "https://s3-eu-west-1.amazonaws.com/apps.cit.datalens.api.here.com/documentation/windfarms_fivestates.csv"
  },
  "format": {
    "delimiter": ",",
    "line_terminator": "\n",
    "quote_char": "\"",
    "encoding": "utf-8",
    "header_line": true,
    "bom": "UTF8",
    "skip_lines": 1
  },
  "schema": {
    "columns": [{
      "alias": "lat",
      "type": "number",
      "name": "lat",
      "index": 0
    },
    {
      "alias": "lon",
      "type": "number",
      "name": "lon",
      "index": 1
    },
    {
      "alias": "output",
      "type": "number",
      "name": "output",
      "index": 2
    },
    {
      "alias": "state",
      "type": "string",
      "name": "state",
      "index": 3
    }],
    "geometries": [{
      "type": "point",
      "x": "lon",
      "y": "lat"
    }]
  }
}

Request Parameters

The table below documents the mandatory request parameters required by this resource.

Note: All the parameters below are required for authentication. For more information about authentication and authorization in general, see the authentication related topics under Getting Started.
Table 2. Request Parameters
Parameter Datatype Description
app_id String A 20-byte Base64 URL-safe encoded string used for the authentication of the client application
app_code String A 20-byte Base64 URL-safe encoded string used for the authentication of the client application
access_token String A temporary string used for authentication. Tokens are valid for one hour.

We recommend that the token be included in the HTTP Header when sending requests. For more information on setting up the access_token in the HTTP Header, see Getting Authentication Credentials.