This is an introduction to using the Dapresy Data Import API. Using the API allows for upload of metadata and case data in your Dapresy projects from any data source available to you.


Using the API will require programming knowledge to create an API client. We provide samples in Python and C# to help with this, as well as Swagger API documentation.

Getting started with the Data Import API

Basics

Access - Who Can use the API?

All Dapresy admin accounts have access to the API to load data into the projects for which they have access.


Where do I find the API endpoint (the URL used for the API)

It is on all live installs, always named host name + “-datapi” – 

A couple of examples: 

    If you use dc.dapresy.com then the endpoint is dc-dataapi.dapresy.com, 

    for live.dapresy.com the end point is live-dataapi.dapresy.com


If you use a vanity URL, e.g. yourcompany.dapresy.com you will need to use the main URL for the install to find the end point, if in doubt please contact support to get the correct address.


Where is the Swagger documentation?

All of the installs have the Swagger, our dashboards installs are here:

https://dashboards-dataapi.dapresy.com/  -- Europe

https://dashboards-na-dataapi.dapresy.com/ -- US


To use the API you will need to create an API client, for further information and resources please refer to the articles here in the manual.


The code samples provide a basic version of an integration to the API.


Frequently Asked Questions

The import method returns "SUCCESS" but there is an error, why?

The import status message is confirming that the data was successfully received. The validation of the data is done separately. The response from the import method contains this information, whether the data is valid "ImportResult.IsValid" and if not what the issue is in "ImportResult.ValidationMessage". Even successful imports can have informational validation messages, so it's worth looking at the value returned.


The following code demonstrates the correct way to determine whether the data was valid:

Task<Response>  importTask = ImportExtensions.PostImportAsync(apiClient.Import, json, projectID);
Response import = await importTask;
if (import.Status.StatusCode == "SUCCESS")
{
    dynamic result = JsonConvert.DeserializeObject<dynamic>(import.Data.ToString());
    if (result.ImportResult.IsValid != true)
    {
        Snackbar.Add($"Validation error {result.ImportResult.ValidationMessage} ", Severity.Error);
    }
    else 
    { 
         Snackbar.Add($"Imported {file.Name} <br/> Info: {result.ImportResult.ValidationMessage} ", Severity.Success);
    }
    validationMessage += result.ImportResult.ValidationMessage;
}
else
{
    Snackbar.Add($"Failed to import {file.Name} <br/> {string.Join("<br/>", import.Status.Messages)} ", Severity.Error);
}



What is the file size limit on Import?

The standard customer file import size limit is applied to the JSON message. The default value is 200MB


I'm getting "Object reference not set to an instance of an object" but can't see an issue?

Check all fields are correct. Fields are case sensitive, for instance metadata must be described in "MetaData" not "Metadata".