CorrelationId: Getting Started

A Correlation ID is a unique identifier used in distributed systems for tracing a particular transaction or event chain in logs.
The application calling APIs can inject an ID called the CorrelationId in the API headers. In such a case, the API response will send back the injected CorrelationId in the API response. There is no change in the API response if the CorrelationID is not injected.

NOTE : Users won’t be able to test/execute Correlation ID implementation from the developer portal, but this feature can be tested using any API client tool Like Postman, Talend etc.

Below is the sample curl request

     
$headers =  @{}
$headers["Authorization"] = "bearer  YOUR AUTHORIZATION TOKEN"
$headers["x-Correlation-ID"] = "YOUR CORRELATION ID"
$headers["content-type"] = "application/json"
$headers["Accept"] = "application/json"

curl -V -Uri "YOUR API URL" -Headers $headers -Method Your method type 

Below is the curl request for Get API


$headers =  @{}
$headers["Authorization"] = "bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1c2VyOjExZWNiNGQ3LTVjMGUtNDQ5MC1hMTZjLTAyNDJhYzExMDAwMiIsInJvbGUiOnsibGVnYWN5SWQiOiJBZG1pbmlzdHJhdG9yIiwic2Vjb25kYXJ5Um9sZXMiOltdLCJpZCI6IjExZWJjODJkLWM1ZTItYTJlMC04MTk0LTAyNDJhYzExMDAwMiIsImxhc3RVcGRhdGVUaW1lIjoxNjY0Nzk5MTA0MjQ2fSwiaWNBZ2VudElkIjoiMjQyMTEiLCJpc3MiOiJodHRwczpcL1wvYXV0aC5kZXYubmljZS1pbmNvbnRhY3QuY29tIiwiZ2l2ZW5fbmFtZSI6IkltZGFkdWwiLCJhdWQiOiJpbnRlcm5hbEBpbmNvbnRhY3QgaW5jLiIsImljU1BJZCI6IjI3IiwiaWNCVUlkIjo0NjY5LCJuYW1lIjoiaW1kYWR1bC5zaGFyaWZAZG83Mi5jb20iLCJ0ZW5hbnRJZCI6IjExZWJjODJkLWJmZTgtNTUxMC05MGNkLTAyNDJhYzExMDAwMiIsImV4cCI6MTY2NDg2NjAzNywiaWF0IjoxNjY0ODYyNDM3LCJmYW1pbHlfbmFtZSI6IlNoYXJpZiIsInRlbmFudCI6InBlcm1fcHVuZV9hcGlfZG83MjQyMTkyMTMzIiwidmlld3MiOnt9LCJpY0NsdXN0ZXJJZCI6IkRPNzIifQ.YSFyyCc3aZ6u1IgOBQUdB7bR3ueSS2FlbGw9WDrXGgCyQrOP9Q1ZaHCJj-QVP9_A93NAz_aMiOfwYlwJzA6yiq6VmiWAEnLuxAoopz-8RCnVYG50QyjkmERwdgmx58ueZSQ_nUQS2qmGkk3O1JIKftxwqORXQWg8QxkWjQBTjsI"
$headers["x-Correlation-ID"] = "29d7c6fc-5535-4cb4-83e5-90d9e0aa6d61"
$headers["content-type"] = "application/json"
$headers["Accept"] = "application/json"

curl -V -Uri https://api-do72.dev.nice-incontact.com/InContactAPI/services/v24.0/agents/24211 -Headers $headers -Method Get
 

Response of Get API


HTTP/1.1 200 Success
Date: Tue, 04 Oct 2022 05:54:42 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 2832
Connection: keep-alive
Set-Cookie: AWSALB=QPdTfDlGPznsXMYThl3dUJoFXs51RkncnbJHcq1caUGMfV8YEgXi51Nnj71CB1jJGCblp9GXU1a/SmtP3H8lTgc2qD+U7bSqVO3W3/kow1f6PD7NHj/fbovvGKUL; Expires=Tue, 11 Oct 2022 05:54:41 GMT; Path=/
Set-Cookie: AWSALBCORS=QPdTfDlGPznsXMYThl3dUJoFXs51RkncnbJHcq1caUGMfV8YEgXi51Nnj71CB1jJGCblp9GXU1a/SmtP3H8lTgc2qD+U7bSqVO3W3/kow1f6PD7NHj/fbovvGKUL; Expires=Tue, 11 Oct 2022 05:54:41 GMT; Path=/; SameSite=None; Secure
Cache-Control: private, no-store, s-maxage=0
Pragma: no-cache
Server: Microsoft-IIS/8.5
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Expose-Headers: Content-Encoding,icServerTime,Date,icBranchValue,icServerName,icStatusDescription
X-Correlation-ID: 29d7c6fc-5535-4cb4-83e5-90d9e0aa6d61
icServerTime: 2022-10-04T05:54:42.041Z
icServerName: DOA-C72API01
icBranchValue: 1
icStatusDescription: Success
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
 

Below is the curl request for Post API


$headers =  @{}
$headers["Authorization"] = "bearer  eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1c2VyOjExZWNiNGQ3LTVjMGUtNDQ5MC1hMTZjLTAyNDJhYzExMDAwMiIsInJvbGUiOnsibGVnYWN5SWQiOiJBZG1pbmlzdHJhdG9yIiwic2Vjb25kYXJ5Um9sZXMiOltdLCJpZCI6IjExZWJjODJkLWM1ZTItYTJlMC04MTk0LTAyNDJhYzExMDAwMiIsImxhc3RVcGRhdGVUaW1lIjoxNjY0Nzk5MTA0MjQ2fSwiaWNBZ2VudElkIjoiMjQyMTEiLCJpc3MiOiJodHRwczpcL1wvYXV0aC5kZXYubmljZS1pbmNvbnRhY3QuY29tIiwiZ2l2ZW5fbmFtZSI6IkltZGFkdWwiLCJhdWQiOiJpbnRlcm5hbEBpbmNvbnRhY3QgaW5jLiIsImljU1BJZCI6IjI3IiwiaWNCVUlkIjo0NjY5LCJuYW1lIjoiaW1kYWR1bC5zaGFyaWZAZG83Mi5jb20iLCJ0ZW5hbnRJZCI6IjExZWJjODJkLWJmZTgtNTUxMC05MGNkLTAyNDJhYzExMDAwMiIsImV4cCI6MTY2NDg2NjAzNywiaWF0IjoxNjY0ODYyNDM3LCJmYW1pbHlfbmFtZSI6IlNoYXJpZiIsInRlbmFudCI6InBlcm1fcHVuZV9hcGlfZG83MjQyMTkyMTMzIiwidmlld3MiOnt9LCJpY0NsdXN0ZXJJZCI6IkRPNzIifQ.YSFyyCc3aZ6u1IgOBQUdB7bR3ueSS2FlbGw9WDrXGgCyQrOP9Q1ZaHCJj-QVP9_A93NAz_aMiOfwYlwJzA6yiq6VmiWAEnLuxAoopz-8RCnVYG50QyjkmERwdgmx58ueZSQ_nUQS2qmGkk3O1JIKftxwqORXQWg8QxkWjQBTjsI"
$headers["x-Correlation-ID"] = "29d7c6fc-5535-4cb4-83e5-90d9e0aa6d61"
$headers["content-type"] = "application/json"
$headers["Accept"] = "application/json"


$postParams = @{
                "tagName" = "testTag"  
                "notes" = "testing"
                } | ConvertTo-Json


curl -v -Uri https://api-do72.dev.nice-incontact.com/InContactAPI/services/v7.0/tags -Headers $headers -Body $postParams -Method Post
 

Response for Post API


HTTP/1.1 200 Success
Date: Tue, 04 Oct 2022 05:47:57 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 12
Connection: keep-alive
Set-Cookie: AWSALB=MygFfOFRmipEDszBapvTh/ic+nb7Ajk7a8rDCLusshxa+ArYAVWB+6VK1DMBEQZ/HHljZLP7c7APxqzQNEMovVAiLID5Ey4Yj/PKJtHG8AU3d0ljWwVtx01LI7ry; Expires=Tue, 11 Oct 2022 05:47:57 GMT; Path=/
Set-Cookie: AWSALBCORS=MygFfOFRmipEDszBapvTh/ic+nb7Ajk7a8rDCLusshxa+ArYAVWB+6VK1DMBEQZ/HHljZLP7c7APxqzQNEMovVAiLID5Ey4Yj/PKJtHG8AU3d0ljWwVtx01LI7ry; Expires=Tue, 11 Oct 2022 05:47:57 GMT; Path=/; SameSite=None; Secure
Cache-Control: private, no-store, s-maxage=0
Pragma: no-cache
Server: Microsoft-IIS/8.5
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Expose-Headers: Content-Encoding,icServerTime,Date,icBranchValue,icServerName,icStatusDescription
X-Correlation-ID: 29d7c6fc-5535-4cb4-83e5-90d9e0aa6d61
icServerTime: 2022-10-04T05:47:57.417Z
icServerName: DOA-C72API01
icBranchValue: 1
icStatusDescription: Success
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains