Reference Dataset

Varsha Neelesh
Varsha Neelesh
  • Updated

List Reference Datasets

Lists all reference datasets.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Example

Request Sample

curl --request POST --url https://api.syncari.com/api/v1/referencedata \
    --header 'Accept: application/json' \
    --header 'Authorization: FTON46895FBIl' \
    --header 'Content-Type: application/json' \
    --header 'clientRequestId: 123456789' \
    --header 'syncariId: VBKIUF'

Response Sample

{
  "success": true,
  "requestId": "2923018703",
  "timestamp": "2022-03-10T02:49:25.300122Z",
  "result": [
    {
      "id": "61e2a1cc34a0f06932054631",
      "name": "Free Email Domains",
      "createdBy": null,
      "createdAt": "2022-01-15T10:28:28.785+00:00",
      "updatedBy": null,
      "updatedAt": "2022-01-15T10:28:30.050+00:00",
      "status": "ACTIVE",
      "importDetails": null,
      "lastImported": "2022-01-15T17:28:30+0700",
      "totalRecords": 4752,
      "usedInFieldPipelines": [],
      "headerColumns": [
        "Email",
        ""
      ]
    },
    {
      "id": "61e2a1cb34a0f069320545f4",
      "name": "US States/Regions with State/Region Codes",
      "createdBy": null,
      "createdAt": "2022-01-15T10:28:27.179+00:00",
      "updatedBy": null,
      "updatedAt": "2022-01-15T10:28:27.815+00:00",
      "status": "ACTIVE",
      "importDetails": null,
      "lastImported": "2022-01-15T17:28:27+0700",
      "totalRecords": 59,
      "usedInFieldPipelines": [],
      "headerColumns": [
        "State/Region Name",
        "State/Region Code"
      ]
    },
    {
      "id": "61e2a1c934a0f06932054439",
      "name": "Currency Codes",
      "createdBy": null,
      "createdAt": "2022-01-15T10:28:25.502+00:00",
      "updatedBy": null,
      "updatedAt": "2022-01-15T10:28:26.470+00:00",
      "status": "ACTIVE",
      "importDetails": null,
      "lastImported": "2022-01-15T17:28:26+0700",
      "totalRecords": 441,
      "usedInFieldPipelines": [],
      "headerColumns": [
        "Entity",
        "Currency",
        "AlphabeticCode",
        "NumericCode",
        "MinorUnit",
        "WithdrawalDate"
      ]
    },
    {
      "id": "61e2a1c634a0f0693205433f",
      "name": "Countries With Regional Codes",
      "createdBy": null,
      "createdAt": "2022-01-15T10:28:22.396+00:00",
      "updatedBy": null,
      "updatedAt": "2022-01-15T10:28:24.622+00:00",
      "status": "ACTIVE",
      "importDetails": null,
      "lastImported": "2022-01-15T17:28:24+0700",
      "totalRecords": 249,
      "usedInFieldPipelines": [],
      "headerColumns": [
        "name",
        "alpha-2",
        "alpha-3",
        "country-code",
        "iso_3166-2",
        "region",
        "sub-region",
        "intermediate-region",
        "region-code",
        "sub-region-code",
        "intermediate-region-code"
      ]
    },
    {
      "id": "61e2a11834a0f06932046bf5",
      "name": "Airport Codes",
      "createdBy": null,
      "createdAt": "2022-01-15T10:25:28.813+00:00",
      "updatedBy": null,
      "updatedAt": "2022-01-15T10:28:21.235+00:00",
      "status": "ACTIVE",
      "importDetails": null,
      "lastImported": "2022-01-15T17:28:21+0700",
      "totalRecords": 55113,
      "usedInFieldPipelines": [],
      "headerColumns": [
        "ident",
        "type",
        "name",
        "elevation_ft",
        "continent",
        "iso_country",
        "iso_region",
        "municipality",
        "gps_code",
        "iata_code",
        "local_code",
        "coordinates"
      ]
    }
  ]
}

 


List Reference By Id

Get a reference dataset by its id (Syncari ID of the reference data set).

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Path Params

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

Example

Request Sample

curl --request GET --url https://api.syncari.com/api/v1/referencedata/62e22c26a8ccd6ac1c2e97c3 \
    --header 'Accept: application/json' \
    --header 'Authorization: FTON46895FBIl' \
    --header 'Content-Type: application/json' \
    --header 'clientRequestId: 123456789' \
    --header 'syncariId: VBKIUF'

Response Sample

{
  "success": true,
  "requestId": "2923018703",
  "timestamp": "2022-03-10T02:49:25.300122Z",
  "result": {
    "id": "61e2a1cb34a0f069320545f4",
    "name": "US States/Regions with State/Region Codes",
    "createdBy": null,
    "createdAt": "2022-01-15T10:28:27.179+00:00",
    "updatedBy": null,
    "updatedAt": "2022-01-15T10:28:27.815+00:00",
    "status": "ACTIVE",
    "importDetails": null,
    "lastImported": "2022-01-15T17:28:27+0700",
    "totalRecords": 59,
    "usedInFieldPipelines": [],
    "headerColumns": [
      "State/Region Name",
      "State/Region Code"
    ]
  }
}

 


Create Reference Dataset

Create a new reference dataset from a csv file.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Query Parameters

 Name
 Type
 Required
fileName

name of the file being uploaded

string
required-table (1).svg
name

name of the reference dataset being created

string
required-table (1).svg
file
multipart/form-data
 

Example

Request Sample

curl --request POST \
  --url https://api.syncari.com/api/v1/referencedata \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'Content-Type: application/json' \
  --header 'clientRequestId: ' \
  --header 'syncariId: ' \
  --data '{
  "name": "Reference Dataset 1",
  "headerColumns": [
    "Header 1",
    "Header 2"
  ]
}'

Response Sample

{
  "success": true,
  "requestId": "2923018703",
  "timestamp": "2022-03-10T02:49:25.300122Z",
  "result": {
    "id": "61e2a1cb34a0f069320545f4",
    "name": "US States/Regions with State/Region Codes",
    "createdBy": null,
    "createdAt": "2022-01-15T10:28:27.179+00:00",
    "updatedBy": null,
    "updatedAt": "2022-01-15T10:28:27.815+00:00",
    "status": "ACTIVE",
    "importDetails": null,
    "lastImported": "2022-01-15T17:28:27+0700",
    "totalRecords": 59,
    "usedInFieldPipelines": [],
    "headerColumns": [
      "State/Region Name",
      "State/Region Code"
    ]
  }
}

 


Delete Reference By Id

Delete a reference dataset by Id. The API will return an error if the dataset is used in any pipeline. Remove the data set from the pipelines it is used in, and retry to delete the data set.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Path Params

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

Example

Request Sample

curl --request DELETE \
  --url https://api.syncari.com/api/v1/referencedata/62e22c26a8ccd6ac1c2e97c3

Response Sample

HTTP OK

 


Get Reference Data Items

Use this api to read reference dataset items by page. The cursorToken can be used to navigate forward. For the first page, ignore the cursorToken. The limit can be specified with default being 1000. The cursorToken is an encoded string of the itemId.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Path Params

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

 

Query Parameters

Name Type Required Notes
cursorToken string  

Use the value from last response to get the next set of records

limit integer  

Limit the number of the records to be returned

Example

Request Sample

curl --request GET \
  --url https://api.syncari.com/api/v1/referencedata/referenceDataId/items \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'syncariId: '

Response Sample

{
  "success": true,
  "requestId": "4115949145",
  "timestamp": "2022-05-27T05:31:24.190431Z",
  "cursorToken": "NjI5MDYyMmI4ZDMyZmE4YWMzYjJhZDUz",
  "result": [
    {
      "id": "6290622b8d32fa8ac3b2ad4e",
      "createdBy": null,
      "createdAt": null,
      "updatedBy": null,
      "updatedAt": null,
      "values": {
        "City Name": "Fremont",
        "_id": "6290622b8d32fa8ac3b2ad4e",
        "Code": "1"
      }
    }
  ]
}

 


 Add Items to Dataset

The api allows you to add records to an existing dataset. The values are accepted as key/value pairs. The keys provided for this api should match the keys originally used for importing data into this dataset.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg
Path Params
 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

 

Example

Request Sample

curl --request POST \
  --url https://api.syncari.com/api/v1/referencedata/referenceDataId/items \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'Content-Type: application/json' \
  --header 'clientRequestId: ' \
  --header 'syncariId: ' \
  --data '[
  {
    "CityName": "San Mateo",
    "Code": 2
  },
  {
    "CityName": "San Francisco",
    "Code": 3
  }
]'

Response Sample

{
  "success": true,
  "requestId": "3982496457",
  "timestamp": "2022-02-08T09:38:51.196672Z",
  "result": [
    "60a6b5dd2e63328d66854534",
    "60a6b5dd2e63328d66854535"
  ]
}



Delete Items from Dataset

This API can be used to delete records from an existing dataset using the record ids. The missing records are skipped.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg
Path Params
 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

 

Body

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

 

Example

Request Sample

curl --request DELETE \
  --url https://api.syncari.com/api/v1/referencedata/referenceDataId/items \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'clientRequestId: ' \
  --header 'syncariId: '

Response Sample

{
  "success": true,
  "requestId": "7021640305",
  "timestamp": "2022-02-08T09:17:51.868472Z",
  "result": {
    "deletedCount": 2
  }
}

 


Update Items in Dataset

Use this endpoint to update rows in an existing reference dataset using the id.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Path Params

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

Body

Pass the array of objects in the body as shown in example. Each object is a key value pair. The key is id of the record to be updated and value is a key value pair, with each element  representing the column to be updated.

Example

Request Sample

curl --request PATCH \
  --url https://api.syncari.com/api/v1/referencedata/referenceDataId/items \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'Content-Type: application/json' \
  --header 'clientRequestId: ' \
  --header 'syncariId: ' \
  --data '{
  "60a6b5dd2e63328d66854534": {
    "Code": 3
  },
  "60a6b5dd2e63328d66854535": {
    "Code": 4
  }
}'

Response Sample

{
  "success": true,
  "requestId": "7021640305",
  "timestamp": "2022-02-08T09:17:51.868472Z",
  "result": {
    "updatedCount": 2
  }
}

 


Replace Items in Dataset

This API can be used to replace records in an existing dataset. The values are accepted as key/value pairs. The keys provided for this API should match the keys originally used for importing data into this dataset.

Request

Headers

 Name
 Type
 Required
syncariId

Id of the instance the API is to be run against

string
 
clientRequestId
Client side request id to be used for idempotency in the future

 

string
required-table (1).svg

Path Params

 Name
 Type
 Required
referenceDataId

Id of the reference dataset being queried

string
required-table (1).svg

Body

Pass the array of objects in the body as shown in example. Each object is a key value pair. The first object specifies what records to replace, and the second object specifies what values to use for replace.

Example

Request Sample

curl --request PUT \
  --url https://api.syncari.com/api/v1/referencedata/referenceDataId/items \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --header 'Content-Type: application/json' \
  --header 'clientRequestId: ' \
  --header 'syncariId: ' \
  --data '[
  {
    "CityName": "string",
    "Code": 0
  }
]'

Response Sample

{
  "success": true,
  "requestId": "string",
  "timestamp": "string",
  "result": [
    "string"
  ]
}
Share this

Was this article helpful?

0 out of 0 found this helpful