Geovisualization Developer's Guide

Uploading Data from a File

To upload data directly from a CSV file with the Geovisualization REST API, you need to specify the path to the file in the request body. The request body's mime-type is multipart/form-data with one mandatory part having the key name and the mime-type file.

Note: Read Data Format Guidelines for more guidance on the best formatting for the file you upload.

To ingest a data file, do the following:

Create an empty dataset with a POST request including your APP_ID, APP_CODE and a name and description in the body:


https://datalens.api.here.com/v1/datasets?app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}

{
  "name": "Name of your new dataset",
  "description": "Description of your new dataset, can be empty"
}
          

You can also use the datasets endpoint in the 04. Datasets CRUD folder of our Postman collection.

You will receive a response body that contains the new dataset ID.

Send a POST request, specifying the {DATASET_ID} you received in the previous step and the file you want to upload as form data with the key name and the mime-type file:

https://datalens.api.here.com/v1/datasets/{DATASET_ID}?app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}

Optionally, you can check the progress of the data ingestion by sending a GET to the following resource, with {JOB_ID} as the job ID included in the response of the previous step:

https://datalens.api.here.com/v1/jobs/{JOB_ID}?app_id={YOUR_APP_ID}&app_code={YOUR_APP_CODE}

You can also use the jobs/_ID_ endpoint in the 10. Dataset Transformations folder of our Postman collection.

You can also upload data and append it to an existing dataset. The uploaded data is first validated against the dataset schema. To append data instead of replacing the dataset contents, add another form field of type text containing the key append and the value 1.

If you prefer to use a GUI, you can use the Geovisualization Data Manager to upload a CSV or JSON file and create a dataset.