Data Sets API

The data sets API can be used to programmatically create and update data sets in MedChat.

Prerequisites

To call the data sets API, first obtain your organization's OrgId and Access Token, as described in the API Authentication documentation.

Create Data Set

API documentation for the create data set endpoint can be found here.

The create data set endpoint accepts a CSV file along with some metadata about the data set to create, and creates the new data set in MedChat for the respective organization.

POST  /external/orgs/{orgId}/dataSets

Request body (multipart/form-data):
  Name: Test Data Set 1
  File: TestDataSet1.csv

Responses: 204, 400, 401, 403

The request is validated according to the following rules (which are the same as those enforced when creating a data set via the MedChat UI):

  • Data set name may contain only alphanumeric characters, spaces, dashes, and underscores.
  • Data set name must be unique for the organization.
  • Column names may only contain alphanumeric characters and underscores.
  • File extension must “.csv”.
  • File must be readable as a CSV file.
  • The first line of the file should contain column headings.
  • Request must not be greater than 30MB.

Update Data Set

API documentation for the update data set endpoint can be found here.

The update data set endpoint accepts a CSV file and a data set ID, and updates the existing data set in MedChat.

PUT /external/orgs/{orgId}/dataSets/{dataSetId}

Request body (multipart/form-data):
  Name: Test Data Set 1
  File: TestDataSet1.csv

Responses: 204, 400, 401, 403, 429

The same rules that are enforced on the create data set endpoint apply to the update data set endpoint.

The data set is locked to additional updates during an update. If a subsequent update request is received for a given data set while a prior update is still in progress, the API returns a 429.