Web API that connects to process model -I need to pass input parameter different and get a different output parameter can anyone help me out?

Hi Appian team,

Web API that connects to process model -I need to pass input parameter different and get a different output parameter can anyone help me out with this , now whatever am passing as input parameter to processparameter same am getting as output parameter as process info.Please edit below code accordingly

below is the currently used web API code snippet:

a!startProcess(
processModel: cons!xxxxxxxxx
processParameters: {
xxxxxxxxxx : a!fromJson(
http!request.body
)
},
onSuccess: a!httpResponse(
statusCode: 200 ,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
fv!processInfo
)
),
onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
error: "There was an error starting the process"
}
)
)
)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to sunus0001

    Sorry I'm not getting what you mean by passing different input parameters. Seems like you're passing a JSON text as API's request body. Do you want to pass data other than that? Then you can make use of query parameters.

    And what do you mean by different output parameters?

  • HI SelvaKumar,

    yes i mean passing as JSON text the input parameters. Am passing a table values as parameter and getting the same table back in output , can i change the output parameter alone, hope you got my point.

  • 0
    Certified Lead Developer
    in reply to sunus0001

    Can you please provide a sample output that you want?

  • OUTPUT should be like this

    {
    "pp": {

    },
    "startTime": "",
    "timeZone": "GMT",
    "starred": false,
    "parentName": "",
    "execId": 0,
    "status": 0
    },
    "pm": {

    },
    "timeZone": "",
    "starred": ,
    "parentName": ""
    },
    "pv": {
    "PF_ApprovalStepCacheList": null,
    "RequestTable": {
    "RequestId": 644,
    "ProcessID": 180223,
    "ReasonCodeID": 17,
    "RegionID": 5,
    "RootCauseID": 54,
    "RoutingMethodID": 1,
    "ShipmentDirectionID": 2,
    "ShipperID": 119,
    "CorrectiveActionReason": "testing - corrective action",
    "DestinationCustomerSupplier": "",

    },
    "zzButton": ""
    }
    }

    ANd INPUT parameter like

    {

    "Order_Del_Number":""

    "Order_Del_Item_Number":""

    "Source_System":""

    }

  • 0
    Appian Employee
    in reply to sunus0001

    Keep in mind that the output and input is directly related to the process variables in your process model. The output you provided above is simply the default output of the web API that includes all the process parameters and process properties. When you map your inputs, you're also mapping to process variables - in this case the fields the variables described in the "pv" field.

    If you want the inputs to be "Order_Del_Number", "Order_Del_Item_Number" and "Source_System", how do you plan to map those in your process? Do you plan to have variables for those?

  • Hi Peter Lewis,

    Thank you for the reply, I understood what happening  behind the API and process model. My input is the data table and input parameters are corresponding  table columns and what process model does is inserting this value to a database, that is using the write to datastore function. 

    I have the following doubts:

    Can I bring the output parameters from the different tables or views which is added as process variable-I hope it is possible?

    Can I pass alias values as table input parameter like table column name is Purchase Order-but parameter name in the the JSON TEXT should be Order_Del_Number.Both are same but i need to have the names changed how can i link them together. What are the different ways available in Appian.

    Thanks

    Sunu Sam