Type of Binary Request Body to be sent from an external system using web api.

Hello all,

As mentioned in the WEB API documentation, I'm trying to send a pdf in base64 format from an external API/Postman. 

However, when I try to open the pdf in an interface within the Document Viewer tag, it says - Failed to load document. I tried downloading and opening this document in my local pc, I get the same error. 

When I'm using an online website to test the same base64 string to document conversion, it works. 

Implementing a similar use case, wherein I'm calling the MSGRAPH GET ATTACHMENT (for a message) API with Appian integration that provides me document data in the form of base64 values. Appian is auto-converting these documents from its base64 format and storing it. 

What am I missing over here? Is there a specific base64 format that Appian understands? Does the request body need additional parameters supporting the base64 string like name, size, content type?  

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Frist, there is only a single variant of base64 encoding.

    Can you share the configuration and the code of that web API?

    Can you try to use curl to call that API? That might remove some of the uncertainties of Postman.

  • Hi  ,

    Thanks for your response. I have resolved the issue.  However, to answer your questions:

    I was developing a block of code using Python which returned a pdf to Appian. 

    When doing this, we do not have to actually write the code for document to base64 conversion, just need to pass the file path to the request object. As done below: 

     As for Postman, we can test the API by uploading the file from your local storage to Postman under the BINARY sub-section in BODY section. 

    Hopefully, this information is of use for someone else in the future. Thanks for your response though.

Reply
  • Hi  ,

    Thanks for your response. I have resolved the issue.  However, to answer your questions:

    I was developing a block of code using Python which returned a pdf to Appian. 

    When doing this, we do not have to actually write the code for document to base64 conversion, just need to pass the file path to the request object. As done below: 

     As for Postman, we can test the API by uploading the file from your local storage to Postman under the BINARY sub-section in BODY section. 

    Hopefully, this information is of use for someone else in the future. Thanks for your response though.

Children