Generic Batch Operations

Prev Next

1.0 Overview

The following example uses Generic Batch API to perform encryption, decryption, and signing operations.

For more information on how to use Generic Batch API, refer to Create a new batch request.

2.0 REST API Using the curl Command

curl '<ENDPOINT-URL>/batch/v1' \
--header 'Authorization: Bearer YhXwwa-6C...ig5g' \
--data '{
  "Batch": {
    "batch_execution_type": "Unordered",
    "items": [
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/encrypt",
          "body": {
            "alg": "AES",
            "plain": "<PLAIN-DATA>",
            "mode": "FPE",
            "key": {"kid": "KEY-UUID"}
          }
        }
      },
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/decrypt",
          "body": {
            "alg": "AES",
            "cipher": "<CIPHER-DATA>",
            "mode": "FPE",
            "key": {"kid": "KEY-UUID"}
          }
        }
      },
      {
        "SingleItem": {
          "method": "POST",
          "operation": "/crypto/v1/sign",
          "body": {
            "key": {"kid": "KEY-UUID"},
            "hash_alg": "Sha256",
            "hash": "<HASH-VALUE>"
          }
        }
      }
    ]
  }
}'

Response:

{
    "Batch": {
        "items": [
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "cipher": "<CIPHER-DATA>",
                            "kid": "<KEY-UUID>"
                        }
                    }
                }
            },
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "kid": "<KEY-UUID>",
                            "plain": "<PLAIN-DATA>"
                        }
                    }
                }
            },
            {
                "SingleItem": {
                    "Result": {
                        "status": 200,
                        "body": {
                            "kid": "<KEY-UUID>",
                            "signature": "<SIGNATURE>"
                        }
                    }
                }
            }
        ]
    }
}