Integration that gets a document that's in base64

Hello,

I'm calling a Google Gmail API to get the attachments of an email, with an Integration. The attachment comes in a form of a base64 document inside the body:

"body": {
    "size": 1111,
    "data": "base64_document_here"
}

I tried to get an attachment with 12KB (around 12k characters) and it works great...

until I use the "Convert base64 values to Appian documents" checkbox:

I've also tried to get a smaller attachment and it seems to be working just fine:

I think it may have to do with Appian trying to convert the JSON into a CDT first, which looks like it's limiting the size to 4000 characters, and then decoding the base64, but I'm not sure.

Has anyone ever had this problem before?

  Discussion posts and replies are publicly visible

Parents
  • Hello, I found a solution for my problem:

    For some reason, Google API base64 documents are not compatible with Appian from base64 values to documents.

    My solution was to save the base64 value that came from Google API, in a constant, and use it in an internal Web API with one twist:

    substitute(
        substitute(cons!GOOGLE_DOC_BASE64, "-", "+"),
        "_",
        "/"
    )

    Replacing the - with + and the _ with / solves this issue when calling my new internal Web API, with the "Convert base64 values to Appian documents".

  • Wow this is great troubleshooting. First off, I'd recommend opening a support case to help determine why the base64 from the gmail integration isn't working with the Appian Integration Object.

    The workaround is really creative, and I would just have one tweak. If using a single constant, I think you will encounter race condition issues if two documents are processed at the same time. To populate the constant, I also imagine you are storing the base64 in process variable memory which you'll want to avoid if possible.

    Since you are already using an Appian Web API in the workaround, I'd recommend placing the call to the Integration Object directly in the Web API before doing the substitute. This will solve for concurrent document processing and also keep the base64 out of process variables.

    For the workaround, even if using raw response value, you will be subject to the 5MB limit on Integration Object response body, meaning you could not retrieve documents where the base64 representation is larger than this. This is another reason why I'd recommend creating a support case to investigate.

  • Thanks for the tips! Indeed, calling the Integration directly in the Web API saves some memory and some nodes on the process model.

    I'll try to follow with a support case so Appian can investigate this issue.

Reply Children
No Data