Encoding a Field Value

Prev Next

Encoding a field value takes the value of the field and runs it through b64 encoding. The encoded result is placed back into the object that will be sent to the other system. It will also decode the response using b64.

If you do not want the response decoded, use a different schema for the request and the response.

To encode a field set the encode flag to true.

Example: Request Token Schema with Encoded Field Value

  "$id": "reqTokenSchema.json",
  "properties": {
    ….
    "Data": {
      "type": "object",
      "properties": {
        "Data": {
          "type": "string",
          "encode": true,
          "external_name": "Data"
        }
      },
      "external_name": "Data"
    }     ….
  },
  "definitions": {}
}

REQUEST WITHOUT ENCODING

{
  "Data": {
    "returnStatus": false,
    "RecordCount": 0,
    "Data": "something random"
  }
}

REQUEST ENCODED

{
  "Data": {
    "returnStatus": false,
     "RecordCount": 0,
     "Data": "c29tZXRoaW5nIHJhbmRvbQ=="
  }