Boundary in multipart form-data to HTTP Request

Hello, to perform a POST type integration in which I want to add a content type multipart/form-data to the body, I have to add the boundary field to the integration header, which I have seen that appian generates in the HTTP Request .

That value that is generated in the HTTP Request is --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9--, and after testing in different environments and files, I have seen that it is always the same.

POST /api/myit-sb/content HTTP/1.1
Content-Type: multipart/form-data; boundary=TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9
X-Requested-By: XMLHttpRequest
Cache-Control: no-cache
Content-Disposition: form-data; name="file"; filename="OP_ATP_DocPrueba.docx"
Content-Length: 12354
Host: aena-dev-restapi.onbmc.com
Connection: Keep-Alive
User-Agent: Appian
Accept-Encoding: gzip,deflate

--TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9
Content-Disposition: form-data; name="file"; filename="OP_Test_DocPrueba.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Transfer-Encoding: binary

Binary content not shown for document, OP_Test_DocPrueba.docx (11.79 KB).
--TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9--

Can someone tell me how to capture the value --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9-- in the HTTP Request or tell me if that value is always the same for Appian?

Thank you so much.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hello, the way we make the call is by adding the boundary generated by appian in the header.

    For now, the only thing we have managed to do is copy by hand the value that appian generates in the HTTP Request and paste it into the header by hand.

    We would like to know if there was any way to make it automatic or not...

    We have also seen different posts in the Appian Community from a few years ago in which the value of the boundary that Appian generates is the same as what we obtain, which is why we believe that it is always the same.

  • 0
    Certified Lead Developer
    in reply to borjam9970

    When looking at your initial post, I see this header.

    Content-Type: multipart/form-data; boundary=TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9

    That is the boundary, automatically added by Appian.

    I do not understand what you are looking for. Can you help me?

  • No, I added that header by hand, appian automatically adds the boundary that appears at the bottom

    --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9
    Content-Disposition: form-data; name="file"; filename="OP_Test_DocPrueba.docx"
    Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
    Content-Transfer-Encoding: binary

    Binary content not shown for document, OP_Test_DocPrueba.docx (11.79 KB).
    --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9--

  • 0
    Certified Lead Developer
    in reply to borjam9970

    OK, but why would you add that header manually? Sorry, but I really do not understand which problem you are trying to solve. Appian already does all the necessary things to create a multipart request.

  • The external system with which I want to communicate asks me to send the boundary in the header, in addition to creating the multipart request in the body.

    Then I need to add capture the value of the boundary that is generated at the bottom of the HTTP request

    --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9
    Content-Disposition: form-data; name="file"; filename="OP_Test_DocPrueba.docx"
    Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
    Content-Transfer-Encoding: binary
    
    Binary content not shown for document, OP_Test_DocPrueba.docx (11.79 KB).
    --TnQmfygKfP801A_kE1bGL-7YAFk_k6gl9--

    and add it to the call header.

    have you understood me now?

    thank you so much!

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Hello Stefan, the web service that we want to call has an input parameter that is the boundary, since the service is multipart, it asks you to indicate by parameter what the delimiting character is. The question that Borja has is how to object to that delimiting character that Appian automatically generates for multipart integrations, in order to be able to send it in the input parameter. We believe that appian always uses the same delimiter code, but we are not sure, if it is always the same, there are no problems, but if it is dynamic, we see no way to capture it.

  • 0
    Certified Lead Developer
    in reply to Raúl Gómez Moya

    OK. IMHO, that's a problematic API design. But sometimes you have to take what you get.

    And I am not aware of a way to get or modify the used boundary string. I suggest to open a support case to try to get an answer from Appian.

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Hi Stefan, we are almost sure that the delimiter string that appian uses does not change, so we can always use the same one. If we detect something new we will comment on it here