Web API to receive a document from an external system

Certified Lead Developer

Hi,

Is it possible to create a WebAPI in Appian that can receive a document?

Basically an API that can handle multipart requests.

 

Regards,

Sunil Zacharia

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Hi Sunil,

    Web Api's in Appian are meant for exposing Appian data or documents to external systems. If you want to recieve a document from external systems you can use integration object.
  • 0
    Certified Lead Developer
    in reply to santoshd378
    Hi Santosh,

    I agree that Web Api's in Appian can expose Appian data/documents to external systems but they can also be used to start processes in Appian.
    My requirment is to start a process in Appian with a document and meta-data as input from an external system which as per my understanding is a valid use case.

    Regards,
    Sunil Zacharia
  • Hi Sunil ,

    As per your requirement you have to start a process model which has parameters coming in from an external system.
    In this case you expose your web api which calls your process model and data from the external system should be given as an input to the web-api which in-turn will be passed to the process model you want to trigger.

    For this to happen, you must set the property processParameters : http!request.body . Where body will be having that external data that you want to pass to the process model.

    Hope this helps.


    Thanks,
    Rohit Ouhal
  • Hi Sunil,
    WebAPI, as it stands today, can serve your purpose halfway through and you need an extra integration with some content manager.
    By using webAPI you will receive a document identifier in the request and with the documentID then you have to make another service call to the content manager to get the document in Appian.
    Thanks
  • 0
    A Score Level 2
    in reply to Sunil Zacharia
    Hi Sunil,
    We are Implemented a different use case, we use to get base64 document data in Json from an Http query smart service and we use that document bytes and convert it into an appian document.
    What i can say here like you can create an json request tha sends the base64 document along with meta data, and pass to the Web Api, now you can store those values in a process variable and convert that base64 document to Appian document.
    This is not a recommended way since this service will be tightly coupled with the base64 document json request only and there is no reusability for the service(web Api) that we are developing the user has to send doc bytes only.
  • 0
    Certified Lead Developer
    in reply to chandu
    Hi Chandu,

    I was looking at exactly the same solution. However I could not find an existing plugin/service that can convert a base64 string into an Appian document directly. How did you manage to do that?
    I agree with you that this is a costly operation but we need this for our use case and we don’t expect high volumes of input through this design.

    Regards,
    Sunil Zacharia
  • +1
    Certified Lead Developer
    Hi couple of things here:

    1. Integration Object is Only meant for Querying / Pushing the data from/to a Service in the Text Format. And also an external System cannot execute an Integration Object directly, instead they can only interact to Appian Web-API.

    2. Dealing with Base64 will slow down your entire environment, because when you perform Base64 conversion, then the document converted size will be much bigger than the actual. Also we never know about the user, what size of document he may to upload. Hence we need Binary Streaming, because Binary Stream reads as well as writes the data simultaneously instead of holding the entire content in memory as Base64 processing.

    3. Now coming to your problem statement, In order to push a document into Appian from an external system, external system need to send a POST request to Appian Web API, where the body should contain the document Download URL of external System, this POST Call will trigger a process in Appian where Appian will pass this Document URL as an input to the target process model as a parameter. Where we need to make the use of HTTP File Download Smart Service to authenticate the endpoint and download the document into Appian and store it under Knowledge Center.


    I agree, we cannot call it as actual Upload mechanism, but as of now, this is the only way for an external system to push a document into Appian with respect to the performance.

    Hope this helps.
  • create a web api or integration and select document download option it will help you to archive it
  • Hi Alok Kumar,

    Thanks for the details. Your answer helped. Any updates from recent versions on this?

    Also we see our base64 conversion plugins takes more than 1.37 times the original data size. Does Binary Streaming keeps the file size as such?

    Regards,
    Arjun.