Tracking Using APIs
  • 16 Nov 2022
  • 1 Minute to read
  • Dark
    Light
  • PDF

Tracking Using APIs

  • Dark
    Light
  • PDF

Article summary

All the API's require some mandatory parameters which are necessary for Atomic Scope to be able to track data. The mandatory parameters are given in the below table. The header values are prefixed with AS to be able to differentiate with your header values not getting mixed with Atomic Scope values.

  • Business Process Name - AS-BusinessProcess
  • Business Transaction Name - AS-BusinessTransaction
  • Stage Name - AS-CurrentStage
  • API Resource ID ( for localhost ) - AS-ResourceId
  • Resource Group Name ( Azure Function) - x-ms-workflow-resourcegroup-name
  • Subscription Id ( Azure Function) - x-ms-workflow-subscription-id

For the API Resource Id , please navigate to Settings - Resources - Add Resource and add a API Resource with a friendly name. After adding the resource click on top of it to obtain the resource id.

Note : Please associate the resource with Workspace before proceeding.

image.png

The API's can be consumed from the URL with its corresponding sub activity name. Here's an below HTTP example which posts to Start Activity API

POST /atomicscope/api/activities/start HTTP/1.1
Content-Type: application/json
AS-BusinessProcess: Order Processing
AS-BusinessTransaction: Purchase Order
AS-CurrentStage: Receive Order
AS-ResourceId: 049a363a-444b-436f-a354-9fe3a97a6253
{
  "previousStage": ".",
  "startedOn": ""
}

If you want to Log an Exception using the API , then post the same mandatory parameters with the below body content.

{
  "exceptionType": "BusinessException",
  "exceptionDetail": "Payment Failed",
  "stageActivityId": "374f7688-8ba5-4e36-bd83-14ecbc15d247"
}

You can also send multiple properties directly under body using trackedProperties from the LogActivity API.

{
  "mainActivityId": "8b266990-993d-4c98-9628-12cc02e67a6f",
  "previousStage": "Receive Order",
  "trackedProperties": {
  	 "messageId": "PO001",
  "senderId": "Contoso",
  "receiverId": "External Seller",
  "messageType": "Notification",
  "batchId": "string",
  "correlationId": "string"
  }
}

After the action is completed you should be able to see an activity in the Atomic Scope portal.


Was this article helpful?

What's Next