Override or set custom value for boundary in an outbound integration - HTTP multipart/form-data

Certified Lead Developer

Hello, I am working on an integration where I need to set a custom value for "boundary". The HTTP request is of Content-Type: multipart form data. The other system expects the boundary value to be "cpi". 

In Headers, I set Content-Type as "multipart/form-data; boundary=cpi". However, in the HTTP request that Appian generates, Appian seems to be using a random boundary value, and ignoring the value that I have set. 

HTTP request that I see: 

I see this data in API trace logs. 

The integration works through Postman, and I see the correct boundary set. Postman screenshot. 

Thank you in advance for your help.

Regards,
Harish

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    By the specification, the boundary can be any string. Expecting a specific value is not a good idea.

    ChatGPT knows this:

    In an HTTP `multipart/form-data` request, the boundary is a crucial component that separates different parts of the data being sent. Here are the key requirements and considerations regarding the boundary:

    1. **Unique Boundary**: The boundary string must be unique within the content being sent. It should not appear in the actual data to avoid confusion in parsing.

    2. **Format**: The boundary string must start with two hyphens (`--`). For example, if the boundary is `myBoundary`, it should be represented as `--myBoundary` at the beginning of each part.

    3. **Content-Type Header**: The boundary must be specified in the `Content-Type` header of the request. The header should look like this:
    ```
    Content-Type: multipart/form-data; boundary=myBoundary
    ```

    4. **Length**: The boundary string should be reasonably short but long enough to ensure uniqueness. A common practice is to use a random string or a combination of characters that is unlikely to appear in the data.

    5. **Termination**: The last boundary must be followed by an additional two hyphens to indicate the end of the multipart data. For example:
    ```
    --myBoundary--
    ```

    6. **Character Set**: The boundary string can include any ASCII characters except for control characters and the delimiter characters (such as space, tab, and the hyphen itself). It is common to use alphanumeric characters and some special characters.

    7. **No Whitespace**: The boundary string should not contain any whitespace characters.

    By adhering to these requirements, the multipart data can be correctly parsed by the server receiving the request.

Reply
  • 0
    Certified Lead Developer

    By the specification, the boundary can be any string. Expecting a specific value is not a good idea.

    ChatGPT knows this:

    In an HTTP `multipart/form-data` request, the boundary is a crucial component that separates different parts of the data being sent. Here are the key requirements and considerations regarding the boundary:

    1. **Unique Boundary**: The boundary string must be unique within the content being sent. It should not appear in the actual data to avoid confusion in parsing.

    2. **Format**: The boundary string must start with two hyphens (`--`). For example, if the boundary is `myBoundary`, it should be represented as `--myBoundary` at the beginning of each part.

    3. **Content-Type Header**: The boundary must be specified in the `Content-Type` header of the request. The header should look like this:
    ```
    Content-Type: multipart/form-data; boundary=myBoundary
    ```

    4. **Length**: The boundary string should be reasonably short but long enough to ensure uniqueness. A common practice is to use a random string or a combination of characters that is unlikely to appear in the data.

    5. **Termination**: The last boundary must be followed by an additional two hyphens to indicate the end of the multipart data. For example:
    ```
    --myBoundary--
    ```

    6. **Character Set**: The boundary string can include any ASCII characters except for control characters and the delimiter characters (such as space, tab, and the hyphen itself). It is common to use alphanumeric characters and some special characters.

    7. **No Whitespace**: The boundary string should not contain any whitespace characters.

    By adhering to these requirements, the multipart data can be correctly parsed by the server receiving the request.

Children