Hello Appian People,
I have a test WEB API(POST) in order to test my integration process.
I also created a test datastore.
{
user:
address:
}
Please see picture
So what i want to happend is that what to add a test process condition:
If the Request result normal, and statusCode 200 - body: received value will be "0"
Incase parameter error,and statusCode 200 - body: received value will be "1"
Anyone has any idea to add this test condition in my Test web API?
Discussion posts and replies are publicly visible
Hi peanut
If there is any parameter error , we cannot give 200 as status code , we can give 400 status code with bad request as response message.
Please refer the below sample code:
if( or( a!isNullOrEmpty(local!value.user), a!isNullOrEmpty(local!value.address) ), a!httpResponse( statusCode: 400, body: "Few parameters are missing-Bad request" ), a!writeToDataStoreEntity( dataStoreEntity: "DATASTORECONST", valueToStore: {"VALUES"}, onSuccess: a!httpResponse( statusCode: 200, body: "Response for Sucess" ), onError: a!httpResponse( statusCode: 500, body: "Internal server Error" ) ) )
Hi Harshitha,
This helped, thanks a lot :)