Hi!!
We are making a web api where within the onsucess of writeEntity goes a deleteEntity , the problem is that Appian generates this 500 error:
"Not to Valid Web API Response. Received: [Lcom.appiancorp.core.data.Record;@1f71aca."
Its like the response of the webApi is not complete o its waiting something.
Any solution?
Regards,Rebeca
Discussion posts and replies are publicly visible
Hi Rebeca,
Could you please share the code snippet?
Hi, it was the brackets added in the deleteEntity inside the onsucess part, without these brackets works well.
I share you the code structure anyway:
The code is:
a!writeToDataStoreEntity(dataStoreEntity: cons!TABLE,valueToStore: local!Datosguarda,onSuccess: with(a!deleteFromDataStoreEntities(dataToDelete: {a!entityDataIdentifiers(entity: cons!TABLE2,identifiers: local!idToDelete)},deletionComment: loggedInUser() & " deleted id " & local!idToDelete,onSuccess: a!httpResponse(statusCode: 200),onError: a!httpResponse(statusCode: 500,headers: {a!httpHeader(name: "Content-Type",value: "application/json")},body: a!toJson({ error:"There was an error writing to the data store"})))),onError: a!httpResponse(statusCode: 500,headers: {a!httpHeader(name: "Content-Type",value: "application/json")},body: a!toJson({ error:"There was an error writing to the data store"})))
Hi rebecar369 -
I see what you're trying to do, but I'm not sure that behavior is supported by the product.
Check the docs:
https://docs.appian.com/suite/help/19.2/Write_to_Data_Store_Entity_Smart_Service.html#inputs
onSuccess behavior is documented as follows: onSuccess (Any Type): A list of saves or an HTTP response to execute after the smart service executes successfully. Created with a!save() or a!httpResponse().
Essentially what this means is that you can use a!save or a!httpResponse in the onSuccess parameter.
If you're looking to initiate multiple side effects in a single API call, consider configuring your API to start a process. Within that process you can design a series of logical operations like the one you've described.
Hi, we are trying you had said (multiple responses in function of some conditions), and there is a problem with the length too, we are calling part of the code in expression rules to simplify it. Another future problem is if works correctly with these code...
Thanks for your answer,