Appending text in base64 - Integration Call

Certified Lead Developer

We are trying to pass doument as base64 in one of our integration call. we followed https://docs.appian.com/suite/help/19.1/Integration_Object.html#examples to make it work. But the interesting part is, we have to append a text to the base64 everytime we send this document as a base 64.

{
"Name": "AAA",
"Address": "BBB"
Photo: todocument(6745)
}

works but as per our service provide we will have to add a text as a prefix to the base 64 that looks like "data:image/jpeg;base64,"

When we attempted

{ 
"Name": "AAA", 
Address: "BBB", 
Photo: "data:image/jpeg;base64," & todocument(6745) 

}

The base64 generation hasn't happened as appending text convert the entire attribute to text before base64 conversion happens. Any suggestions on handling this?

At the moment we are approaching towards building a custom expression that generates base 64 upfront so that we could perform concatenation. but we would like to understand if there is a better way to do this,

Thanks in advance,

Arjun.

  Discussion posts and replies are publicly visible

  • I have observed the same behavior with the Integration Object such that the document/base64 string must be the entire value for that JSON key. Can the web service be updated? I would hate for you to miss out on the features of the Integration Object and build/use something custom and difficult to maintain. Previous plugins that turn documents into base64 strings have all been removed because they can lead to memory issues if used incorrectly. I highly recommend against that approach. That is why the Integration Object does the conversion inside the web service call for you: no memory concerns and the designer never has to deal with the base64 string.

    Workaround: We used to have a plugin node that did exactly this for web service calls but it was deprecated once the Integration Object could handle this. The plugin is still in the AppMarket, but that specific node is hidden from the pallette since it is deprecated. I can provide you a process model with that node and based on my testing, it should accomplish your goal.

    1) import this: community.appian.com/.../base64-request-to-rest-web-service
    2) import application zip file I attached
    3) copy node from sample process model in application zip to your process model
    4) set up your node. follow request string syntax in the example node (document id's wrapped in #s, for example #6745#)

    Send Base64.zip