Skip to main content
Message encoding prevents errors and ambiguity caused by special characters during transmission. Proper encoding ensures data integrity across all API communications.

Encoding Requirements

Byte Data (Signatures & Encrypted Content)

Byte data such as signatures and encrypted content must be Base64-encoded before transmission. When generating a signature, use the base64UrlEncode function: first Base64-encode the signature bytes, then URL-encode (percent-encode) the result so that +, / and = become %2B, %2F and %3D. Method: base64UrlEncode(bytes) = urlEncode(base64(bytes))
base64UrlEncode here is not the RFC 4648 “base64url” alphabet (-/_, no padding). It is standard Base64 followed by URL (percent) encoding, which is why Rebell signature samples contain sequences such as %2F and %3D. To validate a signature, reverse the steps: URL-decode, then Base64-decode (base64UrlDecode).

HTTPS URL Data

URLs must be percent-encoded before transmission to handle special characters correctly. Method: URL encoding (percent-encoding)

Character Sets

Request Body

  • Encoding: UTF-8
  • Content-Type: application/json; charset=UTF-8
All JSON request bodies should be UTF-8 encoded. Special characters in string values are automatically handled by JSON serialization.

Signature Calculation

When calculating signatures, the content to be signed must be properly encoded:
1

Construct String

Build the content to be signed: <HTTP_METHOD> <HTTP_URI>\n<Client-Id>.<Request-Time>.<HTTP_BODY>
2

Encode to Bytes

Convert the string to UTF-8 bytes
3

Sign

Apply the SHA256withRSA signature algorithm with your private key
4

base64UrlEncode

Base64-encode the binary signature, then URL-encode the result
See Call an API via adding a signature for the full procedure, including response validation.

Common Encoding Scenarios

Best Practices

Double Encoding: Be careful not to encode data twice. If you URL-encode a value and then include it in a JSON body that gets URL-encoded again, you’ll have double-encoded data that won’t decode correctly.