Transform API#

API Endpoint https://engine.rpsprod.ch
Protocol HTTPS
Port 443
Authentication True

Authenticate Transform API requests#

API requests against our Transform API must be authenticated. The authentication is done by using an access_token which can be asked with a POST request to the RPS Identity API.

The answer of the POST request contains the access_token that you have to inject in the header of the requests sent to the Transform API endpoint https://engine.rpsprod.ch.

Transform#

post https://engine.rpsprod.ch/transform

Description#

Transforms input data by using:

  • the configuration mapped by the Bearer authentication token used in the request header;
  • the transformers sequences mapped by the processing contexts defined in the request body.

Request header#

Request header's parameterTypeDescriptionRequired
Authorization
string
The access_token obtained with the RPS Identity API prefixed by the word Bearer. E.g.: Bearer eyJhbGciOiJSUzI1NiIsI...JHs-nWLqPlkl3cWis

Request body#

JSON data defining the data instances values to be transformed.

{
  "loggingContext": {
    "guid": "[string]",
    "evidences": [
      {
        "name": "[string]",
        "value": "[string]"
      },
      "..."
    ]
  },
  "rightsContexts": [
    {
      "guid": "[string]",
      "evidences": [
        {
          "name": "[string]",
          "value": "[string]"
        },
        "..."
      ]
    },
    "..."
  ],
  "processingContexts": [
    {
      "guid": "[string]",
      "evidences": [
        {
          "name": "[string]",
          "value": "[string]"
        },
        "..."
      ]
    },
    "..."
  ],
  "requests": [
    {
      "guid": "[string]",
      "loggingContext": {
        "guid": "[string]",
        "evidences": [
          {
            "name": "[string]",
            "value": "[string]"
          },
          "..."
        ]
      },
      "rightsContext": "[string]",
      "processingContext": "[string]",
      "instances": [
        {
          "loggingContext": {
            "guid": "[string]",
            "evidences": [
              {
                "name": "[string]",
                "value": "[string]"
              },
              "..."
            ]
          },
          "dependencyContext": {
            "guid": "[string]",
            "evidences": [
              {
                "name": "[string]",
                "value": "[string]"
              },
              "..."
            ]
          },
          "className": "[string]",
          "propertyName": "[string]",
          "value": "[string]"
        },
        "..."
      ]
    },
    "..."
  ]
}
Request body's parameterTypeDescriptionRequired
loggingContext request[i] .loggingContext request[i] .instances[j] .loggingContext
object
the logging context object. Can be specified at different levels:
  • root level: applies to the transformation of all instances in all requests objects
  • request level: applies to the transformation of all instances in the given requests object. Overrides the loggingContext defined at root level.
  • instance level: applies only to the transformation of the given instances object. Overrides the loggingContext defined at request level.
rightsContexts
array
an array of one or more rights context objects. Can be specified only at root level
processingContexts
array
an array of one or more processing context objects. Can be specified only at root level
requests
array
list of request objects. Each request object contains one or more data instances' values to be transformed.
request[i] .guid
string
a random generated valid GUID defining the request i.
request[i] .rightsContext
string
the guid of the rightsContext to be used in transformation request i, as defined at JSON object's root level.
request[i] .processingContext
string
the guid of the processingContext to be used in transformation request i, as defined at JSON object's root level.
request[i] .instances
array
list of data instances objects. Each instance object contains the value to be transformed.
request[i] .instances[j] .dependencyContexts
object
the dependency context object. Can be specified only at one level:
  • instance level: applies only to the transformation of the given instance object.

Response body#

JSON data with the transformed data instances' values.

{
  "responses": [
    {
      "request": "[string]",
      "rightsContext": "[string]",
      "processingContext": "[string]",
      "instances": [
        {
          "className": "[string]",
          "propertyName": "[string]",
          "value": "[string]",
          "error": {
            "code": "[string]",
            "message": "[string]"
          }
        },
        "..."
      ]
    },
    "..."
  ],
  "error": {
    "code": "[string]",
    "message": "[string]"
  }
}
Response parameterTypeDescriptionRequired
responses
array
list of response objects. Each response object contains one or more transformed data instance values.
responses[i] .request
string
the guid of the corresponding request object.
responses[i] .rightsContext
string
the guid of the corresponding rightsContext object as defined in the request JSON object's root level.
responses[i] .processingContext
string
the guid of the corresponding processingContext object as defined in the request JSON object's root level.
responses[i] .instances
string
list of data instances objects. Each instance object contains the transformed value.
error responses[i] .instances .error
object
the error object. Can be specified at different levels:
  • root level: it is a global error, triggered by something wrong in the entire request.
  • instance level: it is triggered by a single data instance's transformation.

Example of request#

In this example of requests we ask for 3 transformations.

All the 3 requests have the same rights context which is instantiated with the evidence Operator="Manager".

Two processing contexts are instantiated: one with the evidence Action="Transform" and one other with the evidence Action="Unprotect".

Then the requested 3 transformations are:

  1. Data instance = account.IBAN: transform the account's IBAN value "ES7921000813610123456789" and push to the audit logs a status attribute to be equal to "READY". In order to transform the IBAN, we need the helper values City="Rome" and lenght="37". In this case the data instance to be transformed is [code account.IBAN#]
  2. Data instance = customer.name: transform the customer's name "Albert"
  3. Data instance = undefined: unprotect the value "@__asds33df23qaasdasd". In this case the id of the data instance is not specified in the request because it is encoded inside the value to be transformed.
{
  "rightsContexts": [
    {
      "guid": "51f62cd6-c95e-4a2d-a30e-3061517a2ded",
      "evidences": [
        {
          "name": "Operator",
          "value": "Manager"
        }
      ]
    }
  ],
  "processingContexts": [
    {
      "guid": "18405c5b-0f72-40a5-93f2-b53fceb74a1a",
      "evidences": [
        {
          "name": "Action",
          "value": "Transform"
        }
      ]
    },
    {
      "guid": "2791f745-691c-4aa7-ab2d-b684a7906194",
      "evidences": [
        {
          "name": "Action",
          "value": "Unprotect"
        }
      ]
    }
  ],
  "requests": [
    {
      "guid": "6f3c45f7-476d-46f1-90ed-2ed8374f690c",
      "rightsContext": "51f62cd6-c95e-4a2d-a30e-3061517a2ded",
      "processingContext": "18405c5b-0f72-40a5-93f2-b53fceb74a1a",
      "instances": [
        {
          "loggingContext": {
            "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "evidences": [
              {
                "name": "status",
                "value": "READY"
              }
            ]
          },
          "dependencyContext": {
            "guid": "38d891de-7bd5-42ef-8150-d0d44ce9316f",
            "evidences": [
              {
                "name": "city",
                "value": "Rome"
              },
              {
                "name": "length",
                "value": "37"
              }
            ]
          },
          "className": "account",
          "propertyName": "IBAN",
          "value": "ES7921000813610123456789"
        },
        {
          "className": "customer",
          "propertyName": "name",
          "value": "Albert"
        }
      ]
    },
    {
      "guid": "92d14f3c-b52b-4b03-b6ac-01e2bb563faa",
      "rightsContext": "51f62cd6-c95e-4a2d-a30e-3061517a2ded",
      "processingContext": "2791f745-691c-4aa7-ab2d-b684a7906194",
      "instances": [
        {
          "loggingContext": {
            "guid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "evidences": [
              {
                "name": "source",
                "value": "in country"
              }
            ]
          },
          "value": "@__asds33df23qaasdasd"
        }
      ]
    }
  ]
}

Example of response#

The result of the above transformation request is:

  1. IBAN's value "ES7921000813610123456789" has been transformed to "AA0034534058930459304593"
  2. The transformation of customer's name "Albert" generated an error. The value has not been transformed.
  3. The value "@__asds33df23qaasdasd" has been unprotected to "12'450 CHF"
{
  "responses": [
    {
      "request": "6f3c45f7-476d-46f1-90ed-2ed8374f690c",
      "rightsContext": "51f62cd6-c95e-4a2d-a30e-3061517a2ded",
      "processingContext": "18405c5b-0f72-40a5-93f2-b53fceb74a1a",
      "instances": [
        {
          "className": "account",
          "propertyName": "IBAN",
          "value": "AA0034534058930459304593"
        },
        {
          "className": "customer",
          "propertyName": "name",
          "value": "null",
          "error": {
            "code": "8d39bc4c-8698-4f7b-a4f8-ba74b593f86e",
            "message": "Processing context not found"
          }
        }
      ]
    },
    {
      "request": "92d14f3c-b52b-4b03-b6ac-01e2bb563faa",
      "rightsContext": "51f62cd6-c95e-4a2d-a30e-3061517a2ded",
      "processingContext": "2791f745-691c-4aa7-ab2d-b684a7906194",
      "instances": [
        {
          "value": "12'450 CHF"
        }
      ]
    }
  ]
}