HTTP POST protect

This API returns protected data.
URI
https://hostname/v4/protect
Method
POST
Parameters
Hostname: Host name of the endpoint, as defined in the AP-REST deployment.

Resource: The resource to be used, which is /v4/protect.

Request Body

  • User: Name of the user executing the API. The user must be present in the policy.
  • Payload:
    • dataElement: Name of the data element used to protect the data. This field is mandatory.
    • data: Data to be protected. This field is mandatory.
    • externalIv: External Initialization Vector (IV) used for protecting the data.
    • externaltweak: External tweak used for protecting the data.
Result
This API returns protected data.

Example 1

Without external IV and external tweak

$ curl --location --request POST 'https://<hostname>/v4/protect' \
--header 'Content-Type: application/json' \
--header 'X-Correlation-ID: k81d1fae-7dec-41g0-a765-90a0c31e6wf5' \
--data '{"payload":[{"id":1,"dataElement":"TE_A_N_S13_L0R0_Y_ST","data":["bG9jaGFu"],"encoding":"base64"}],"user":"user1"}'
--cacert iap-rest-ca.crt --cert iap-rest-client.crt  --key iap-rest-client.key  

Response 1

Without external IV and external tweak

The following response appears for the status code 200, if the API is invoked successfully.

    {
  "errorCount": 0,
  "results": [
    {
      "id": 1,
      "encoding": "base64",
      "data": [
        "cEJPM2pF"
      ],
      "returnCode": 6
    }
  ]
}

Example 2

With external IV

$ curl --location --request POST 'https://<hostname>/v4/protect' \
--header 'Content-Type: application/json' \
--header 'X-Correlation-ID: k81d1fae-7dec-41g0-a765-90a0c31e6wf5' \
--data '{"payload":[{"id":1,"dataElement":"TE_A_N_S13_L0R0_Y_ST","data":["bG9jaGFu"],"externalIv":"cHJvdGVncml0eQ==","encoding":"base64"}],"user":"user1"}'
--cacert iap-rest-ca.crt --cert iap-rest-client.crt  --key iap-rest-client.key  

Response 2

With external IV

The following response appears for the status code 200, if the API is invoked successfully.

    {
  "errorCount": 0,
  "results": [
    {
      "id": 1,
      "encoding": "base64",
      "data": [
        "b2Rnb1ky"
      ],
      "returnCode": 6
    }
  ]
}

Example 3

With external tweak

$ curl --location --request POST 'https://<hostname>/v4/protect' \
--header 'Content-Type: application/json' \
--header 'X-Correlation-ID: k81d1fae-7dec-41g0-a765-90a0c31e6wf5' \
--data '{"payload":[{"id":1,"dataElement":"FPE_FF1_LA_APIP_L0R0_ASTNI_M2.UTF8","data":["bG9jaGFu"],"external_tweak_":"eIvJdGKncnl8eS==","encoding":"base64"}],"user":"user1"}'
--cacert iap-rest-ca.crt --cert iap-rest-client.crt  --key iap-rest-client.key  

Response 3

With external tweak

The following response appears for the status code 200, if the API is invoked successfully.

    {
  "errorCount": 0,
  "results": [
    {
      "id": 1,
      "encoding": "base64",
      "data": [
        "b2Rnb1ky"
      ],
      "returnCode": 6
    }
  ]
}

Last modified : December 18, 2025