Appian Web API needs to exposed to start a process in Appian with documents from external system

Certified Senior Developer

Is it possible to receive one or more documents from external system via Appian Web API  to start a process in Appian with received documents from external system?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi ,

    Yes, it is possible. Please refer the document and sharing code snippet as well. 

    https://docs.appian.com/suite/help/20.3/passing-a-web-api-document-into-a-process-model.html

    Use below code as it is, only change Process model Constant:-

    a!localVariables(

    /*Check whether the request body contains a document*/
    local!success: not(or(rule!APN_isEmpty(http!request.body),isnull(http!request.body)) ),

    if(
    local!success,

    /*If a document was uploaded, start the Upload Student Transcript process*/
    a!startProcess(
    processModel: cons!XYZCONSTANT,
    processParameters: {

    /*A document*/
    transcript: http!request.body,
    /*unid:http!request.headers.unid*/
    unid:http!request.queryParameters.docFolderName

    /*Metadata from parameters or headers*/
    /*studentId: http!request.queryParameters.studentId*/
    },
    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")
    )


    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {},
    body: "500 Internal Server Error"
    )
    ),

    /*If no document was uploaded, return an error code*/
    a!httpResponse(
    statusCode: 400,
    headers: {},
    body: "400 Document Not Provided"
    )
    )
    )

    Thanks,
    Sandeep

Reply
  • 0
    Certified Senior Developer

    Hi ,

    Yes, it is possible. Please refer the document and sharing code snippet as well. 

    https://docs.appian.com/suite/help/20.3/passing-a-web-api-document-into-a-process-model.html

    Use below code as it is, only change Process model Constant:-

    a!localVariables(

    /*Check whether the request body contains a document*/
    local!success: not(or(rule!APN_isEmpty(http!request.body),isnull(http!request.body)) ),

    if(
    local!success,

    /*If a document was uploaded, start the Upload Student Transcript process*/
    a!startProcess(
    processModel: cons!XYZCONSTANT,
    processParameters: {

    /*A document*/
    transcript: http!request.body,
    /*unid:http!request.headers.unid*/
    unid:http!request.queryParameters.docFolderName

    /*Metadata from parameters or headers*/
    /*studentId: http!request.queryParameters.studentId*/
    },
    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")
    )


    ),
    onError: a!httpResponse(
    statusCode: 500,
    headers: {},
    body: "500 Internal Server Error"
    )
    ),

    /*If no document was uploaded, return an error code*/
    a!httpResponse(
    statusCode: 400,
    headers: {},
    body: "400 Document Not Provided"
    )
    )
    )

    Thanks,
    Sandeep

Children
No Data