Skip to Content

Documentation

Risk Cloud API: Data Repositories

Please reference our Data Repositories Help Article for in-depth information about the functionality and permissions needed. 

Obtain your API Access Token to get started.

High Overview of the Components Involved:

  1. Data Repository contains Item Fields ex
    • Data Repository => Risk Cloud Ingredients
    • Item Fields created on Risk Cloud Ingredients => Name, Description
  2. Data Repository contains Items that are mapped to the Item Fields structure. Example:
External IdNameDescription
<item external id>FlourA sack of flour.

Step 1 Create and Update Data Repository

1.1 Check if Data Repository Name Already Exist

This endpoint will check if the requested Data Repository name already exist. We recommend doing this first before creating a new Data Repository.

This endpoint has the following parameters:

Query ParameterRequiredDescription
nameNoThe Data Repository name you want to verify.

Response

Response ParameterDescription
booleanReturn true if the Data Repository name already exist.
Return false if the Data Repository name does NOT already exist.

1.2 Create Data Repository

This endpoint will create a new Data Repository. We recommend that you check the name for uniqueness before proceeding.

POST/api/v1/data-repository

This endpoint has the following parameters:

Query ParameterRequiredDescription
DataWarehouseInYesThe DataWarehouseIn request you want to create. This will be in the request body. See below for DataWarehouseIn.

<DataWarehouseIn>

Request Object ParameterRequest Object TypeDescription
nameStringThe Data Repository name. Must be unique and cannot be blank.
descriptionStringThe Data Repository description.
itemPrefixStringThe Data Repository item prefix. Cannot be blank.
externalIdDisplayNameStringThe Data Repository external Id display name. Not needed for Data Repository creation.

Response

<DataWarehouseOut>

Response ParameterDescription
idThe Data Repository Id.
createdThe date the Data Repository was created.
updatedThe date the Data Repository was updated.
nameThe Data Repository name.
descriptionThe Data Repository description.
itemPrefixThe Data Repository item prefix.
sequenceThe Data Repository sequence. Will always be set to zero.
externalIdDisplayNameThe Data Repository external Id display name.
itemFieldsThe list of ItemFieldOut for the Data Repository. See below for ItemFieldOut.
itemCountThe number of Items for the Data Repository.

<ItemFieldOut>

Response ParameterDescription
idThe Item Field id.
createdThe date the Item Field was created.
updatedThe date the Item Field was updated.
nameThe Item Field name.
displayOrderThe Item Field display order.
displayInRecordsIf the Item Field should be displayed in records.
primaryFieldIf the Item Field is a primary field. Only one Item Field may be primary field at a time.

1.3 Update Data Repository

This endpoint will update a single Data Repository.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.
Query ParameterRequiredDescription
DataWarehouseInYesThe DataWarehouseIn request you want to create. This will be in the request body. <DataWarehouseIn> – same as 1.2 Response

Response

<DataWarehouseOut> – same as 1.2 Response.

Step 2 Create and Update Item Field on Data Repository

2.1 Check if Item Field Name Already Exist

This endpoint will check if the requested Item Field name already exist. We recommend doing this first before creating a new Item Field.

This endpoint has the following parameters:

Query ParameterRequiredDescription
data-repository-idNoThe Data Repository you want to verify the Item Field on.
nameNoThe Item Field name you want to verify.

Response

Response ParameterDescription
booleanReturn true if the Item Field name already exist on the specified Data Repository.
Return false if the Item Field name does NOT already exist on the specified Data Repository.

2.2 Create Item Field on Data Repository

This endpoint will create a new Item Field on the specified Data Repository.

POST/api/v1/data-repository/{id}/item-field

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.
Query ParameterRequiredDescription
ItemFieldInYesThe ItemFieldIn request you want to create. This will be in the request body. See below for ItemFieldIn.

<ItemFieldIn>

Request Object ParameterRequest Object TypeDescription
nameStringThe Item Field name. Must be unique and cannot be blank.
displayInRecordsbooleanShould the Item Field display in records.
primaryFieldbooleanIs the Item Field the primary field.
displayOrderintThe Item Field display order.

Response

<ItemFieldOut> – same as 1.2 Response.

2.3 Update Item Field on Data Repository

This endpoint will update a Item Field.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Item Field Id.
Query ParameterRequiredDescription
ItemFieldInYesThe ItemFieldIn request you want to update. This will be in the request body. <ItemFieldIn> – same as 2.2 Response.

Response

<ItemFieldOut> – same as 1.2 Response.

Step 3 Import Item into Data Repository

3.1 Download the Import Data Template

This endpoint will download the import data template. You can populate it with Item data and upload it later.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.

Response

Response ParameterDescription
StreamingResponseBodyReturns the import data template file in csv format.

3.2 Upload the Import Data Template

This endpoint will upload your Item data into the Data Repository. This will create and/or update the Items based on an external id. Only columns where the headers match an Item Field name for the Data Repository will be used.

POST/api/v1/data-repository/{id}/items/import

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.
fileThe file you want to upload to process. Should be in csv format.

Response

200 status code with an empty body.

3.3 Search All Items

This endpoint will search and return all the Items for a given Data Repository.

POST/api/v1/data-repository/{id}/items

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.
Query ParameterRequiredDescription
item-fieldNoOptional Item Field Id to filter the results.
queryNoOptional query string to filter the results.
itemSearchFiltersNoOptional list of ItemSearchFilter to filter the results. See below for ItemSearchFilter.
pageable paramsNoOptional pageable params ex sort or size.

<ItemSearchFilter>

Request Object ParameterRequest Object TypeDescription
itemFieldIdStringThe Item Field Id. Must be unique and cannot be blank.
searchTypeItemSearchTypeThe search type ex TEXT or NUMBER or FIXED_DATE.
operatorOperatorThe operator type ex EQUALS or NOT_EQUALS or GREATER_THAN_EQUALS.
textValueStringThe text value.
numberValueFloatThe number start value.
endNumberValueFloatThe number end value.
dateValueDateThe date start value.
endDateValueDateThe date end value.
dateRangeTypeDateRangeTypeThe date range type ex FIXED or LAST_THREE_MONTHS or NEXT_ONE_YEAR.

Response

Response ParameterDescription
Page<ItemOut>Returns a pageable of ItemOut. See below for ItemOut.

<ItemOut>

Request Object ParameterRequest Object TypeDescription
idStringThe Item Id.
createdDateThe date the Item was created.
updatedDateThe date the Item was updated.
sequenceIdlongThe Item sequence Id.
externalIdStringThe Item Id external Id.
dataRepositoryDataWarehouseOutThe DataWarehouseOut item is associated with. <DataWarehouseOut> – same as 1.2 Response.
values MapMap of Item Field Id and Item Field value.

This endpoint will link a Record to one or more Items.

This endpoint has the following parameters:

Required Path ParameterDescription
data-repository-idThe unique Data Repository Id.
record-idThe unique Record Id.
Query ParameterRequiredDescription
externalIdsYesThe external Ids from the Items that you want to unlink from the Record. This will be in the request body.

Response

200 status code with an empty body.

This endpoint will unlink a Record from one or more Items.

This endpoint has the following parameters:

Required Path ParameterDescription
data-repository-idThe unique Data Repository Id.
record-idThe unique Record Id.
Query ParameterRequiredDescription
externalIdsYesThe external Ids from the Items that you want to unlink from the Record. This will be in the request body.

Response

200 status code with an empty body.

Step 5 Other

5.1 Find Data Repository

This endpoint will find the specified Data Repository with related Item Fields.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.

Response

<DataWarehouseOut> – same as 1.2 Response.

5.2 Find All Data Repositories

This endpoint will find all the Data Repositories with their related Item Fields.

This endpoint has the following parameters:

Query ParameterRequiredDescription
include-item-countsNoOptional boolean field to include the number of items in each data repository. It defaults to ex false.
pageable paramsNoOptional pageable params ex sort or size.

Response

Response ParameterDescription
Page<DataWarehouseOut>Pageable list of DataWarehouseOut. <DataWarehouseOut> – same as 1.2 Response.

5.3 Delete Data Repository

This endpoint will delete the specified Data Repository. This will permanently remove all associated Items and Item Fields. 

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Data Repository Id.

Response

200 status code with an empty body.

5.4 Find Item Field

This endpoint will allow you to find a single Item Field.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Item Field Id.

Response

<ItemFieldOut> – same as 1.2 Response.

5.5 Delete Item Field

This endpoint will delete the specified Item Field. Any remaining fields in the Data Repository will be reordered appropriately.

This endpoint has the following parameters:

Required Path ParameterDescription
idThe unique Item Field Id.

Response

200 status code with an empty body.

5.6 Find Items Linked to Record

This endpoint will find the specified Items that are linked to the record given the record id passed in via a path parameter.

POST/api/v1/data-repository/{data-repository-id}/items/search/{record-id}

This endpoint has the following path and query parameters:

Required Path ParameterDescription
data-repository-idThe unique Data Repository Id.
record-idThe unique Record Id.
Query ParameterRequiredDescription
include-all-fieldsNoOptional boolean field to return all field data or only the filtered fields.
queryNoOptional additional text filtering you may want to add.
link-stateNoOptional linked state to search for LINKED or NOT_LINKED items. Defaults to LINKED.
pageable paramsNoOptional pageable params ex sort or size.

Response

Response ParameterDescription
Page<ItemOut>Returns a pageable of ItemOut. See below for ItemOut.