Need help in converting Base64 encode string to PDF in an API exposed from APPIAN to SAP as input parameter

Hi Appian Team,

We have a use case where Appian API integrated with SAP , and  the SAP system will input base 64 encoded strings for pdf, we have to read the same from the input variables and convert the same to PDF.

Can anyone help us to implement the  same if we anyone have already implemented or have knowledge about this?

thanks

Sunu Sam

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Hi Stefan,

    I will also try the same and let you know the end results.

    Thanks

    Sunu Sam

  • HI Stefan,

    I have tried what mentioned in the link given above, I really need help in completing this ,I tried a POC it is accepting only binary format document not "application/json".

    Can you help me with this scenario like accepting base 64 encoded string in "application/json" format and converting it into original doc format and saving in Appian.

    the document will be send in an integration with SAP where Appian API is exposed and they are consuming our API.

    If you are not finding a solution can Appian support help me with this scenario??This is really important requirement for our current integration with SAP!

    Thanks

    Sunu Sam

  • "PF_request": {
        "first_name": "John",
        "last_name": "Dow",
        "photo": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
    }
    Hi Attached sample input string

  • HI Stefan ,

    attaching sample code from my POC.

    thanks please reply!

    Sunu Sam

    a!localVariables(
      /*Check whether the request body contains a document*/
      local!success: not(isnull(http!request.body)),
      if(
        local!success,
        a!startProcess(
          processModel: cons!Base64ToPdfConversionPOC,
          processParameters: {
            /*A document*/
            Transcript: todocument(http!request.body),
            
          },
          /*If a document was uploaded, return a successful response*/
          onSuccess: a!httpResponse(
            statusCode: 200,
            headers: { },
            /*Print the document id, name, and extension of the uploaded document*/
            body: concat(
              "Upload Successful: ",
              document(http!request.body, "id"),
              " - ",
              document(http!request.body, "name"),
              ".",
              document(http!request.body, "extension")
            )
          )
        ),
        /*If no document was uploaded, return an error code*/
        a!httpResponse(
          statusCode: 400,
          headers: { },
          body: "400 Document Not Provided"
        )
      )
    )