The /api/process endpoint expects a JSON object in the request body containing three keys: input, transforms, and settings. Then it transforms the given input with provided transformations and settings and returns the transformed output.

Input: The input key holds a JSON object with initial data or context used for transformations.

Transforms:

  • The transforms key contains a list of operations.
  • Each operation in this list is a JSON object with exactly one key-value pair.
  • The value of this key-value pair can be:
    • A string representing a transformation expression.
    • Another list of operations, where each operation also follows the same rule of having a JSON object with only one key-value pair.
  • This structure supports both simple and nested transformations, ensuring each operation is clearly defined with a single key.

Settings:

  • The settings key currently supports a JSON object with a single option: merge_method.
  • The merge_method can be one of three values:
    • overwrite: Replaces items in input with the transformed values.
    • transforms_only: Returns only the items that have been modified by transformations, excluding any items from input that remain unchanged.
    • preserve: Returns the input as it is, but includes an additional key called transforms which contains only the transformed items.
Sample request :
{
  "input": {
    "name": {
      "first": "Malory",
      "last": "Archer"
    },
    "exes": [
      "Nikolai Jakov",
      "Len Trexler",
      "Burt Reynolds"
    ],
    "lastEx": 2
  },
  "transforms": [
    {
      "lastEx": "input.lastEx + 5"
    }
  ],
  "settings": {
    "merge_method": "overwrite"
  }
}
Response :
{
  "name": {
    "first": "Malory",
    "last": "Archer"
  },
  "exes": [
    "Nikolai Jakov",
    "Len Trexler",
    "Burt Reynolds"
  ],
  "lastEx": 7
}

The /api/run endpoint expects a JSON object in the request body containing three keys: input, emailId, and transformName. Then it transforms the given input with transformations and settings fetched from the KV store for given emailId and transformName and then returns the transformed output. The transforms can be saved in KV store using /api/saveTransform endpoint.

Input: The input key holds a JSON object with initial data or context used for transformations.

Email Id: The emailId key expects a valid email address, using which you can save your transformations.

Transform Name: The transformName key expects a valid transform name, using which you can save your transformations.

Sample request :
{
  "input": {
    "name": {
      "first": "Malory",
      "last": "Archer"
    },
    "exes": [
      "Nikolai Jakov",
      "Len Trexler",
      "Burt Reynolds"
    ],
    "lastEx": 2
  },
  "emailId": "someone@example.com",
  "transformName": "TRANSFORM1"
}
Response :
{
  "name": {
    "first": "Malory",
    "last": "Archer"
  },
  "exes": [
    "Nikolai Jakov",
    "Len Trexler",
    "Burt Reynolds"
  ],
  "lastEx": 7
}

The /api/saveTransform endpoint expects a JSON object in the request body containing four keys: transformName, transforms, settings, and emailId. Then it saves the transforms and settings in the KV store for given emailId and transformName and then returns the status if the transformations are successfully saved or not.

Transforms: The transforms key expects a valid parsed transforms object as explained in /api/process.

Settings: The settings key expects a valid settings object as explained in /api/process.

Email Id: The emailId key expects a valid email address, which is required in fetching your saved transforms.

Transform Name: The transformName key expects a valid transform name, which is required in fetching your saved transforms.

Sample request :
{
  "transforms": [
    {
      "lastEx": "derived.lastEx + 5"
    }
  ],
  "settings": {
    "merge_method": "overwrite"
  },
  "emailId": "someone@example.com",
  "transformName": "TRANSFORM1"
}
Response :
{
  "status": "The transforms are saved successfully!...",
  "versionstamp": "00000000000000010000"
}

The /api/retrieveTransform endpoint expects a JSON object in the request body containing two keys: transformName, and emailId. Then it fetches the transforms and settings from the KV store.

Email Id: The emailId key expects a valid email address, which is required in fetching your saved transforms.

Transform Name: The transformName key expects a valid transform name, which is required in fetching your saved transforms.

Sample request :
{
  "emailId": "someone@example.com",
  "transformName": "TRANSFORM1"
}
Response :
{
  "key": [
    "someone@example.com",
    "TRANSFORM1"
  ],
  "versionstamp": "00000000000000010000",
  "value": {
    "transforms": [
      {
        "lastEx": "input.lastEx + 5"
      }
    ],
    "settings": {
      "merge_method": "overwrite"
    }
  }
}

The /api/retrieveAllTransformsByEmail endpoint expects a JSON object in the request body containing one key: emailId. Then it fetches all the transforms and settings from the KV store with the given emailId.

Email Id: The emailId key expects a valid email address, which is required in fetching your saved transforms.

Sample request :
{
  "emailId": "someone@example.com"
}
Response :
[
  {
    "key": [
      "someone@example.com",
      "TRANSFORM1"
    ],
    "versionstamp": "00000000000000010000",
    "value": {
      "transforms": [
        {
          "lastEx": "input.lastEx + 7"
        }
      ],
      "settings": {
        "merge_method": "overwrite"
      }
    }
  },
  {
    "key": [
      "someone@example.com",
      "TRANSFORM2"
    ],
    "versionstamp": "00000000000000010000",
    "value": {
      "transforms": [
        {
          "lastEx": "input.lastEx + 5"
        }
      ],
      "settings": {
        "merge_method": "preserve"
      }
    }
  }
]

The /api/deleteTransform endpoint expects a JSON object in the request body containing two keys: transformName, and emailId. Then it deletes the transforms and settings from the KV store.

Email Id: The emailId key expects a valid email address, which is required in deleting your saved transforms.

Transform Name: The transformName key expects a valid transform name, which is required in deleting your saved transforms.

Sample request :
{
  "emailId": "someone@example.com",
  "transformName": "TRANSFORM1"
}
Response :
{
  "status": "The transform TRANSFORM1 is deleted successfully"
}

The /api/deleteAllTransformsByEmail endpoint expects a JSON object in the request body containing one key: emailId. Then it deletes all the transforms and settings from the KV store with the given emailId.

Email Id: The emailId key expects a valid email address, which is required in deleting your saved transforms.

Sample request :
{
  "emailId": "someone@example.com"
}
Response :
{
  "status": "All transforms created by user someone@example.com are deleted successfully"
}

The /api/health endpoint tells if the service is UP and running or not.

Response :
{
  "status": "UP"
}

The /api/errors returns the error codes list from the core datadance module.

Response :
[
  "error-101",
  "error-102",
  "error-103",
  "error-104",
  "error-105"
]