Jbowes | 2017-12-01 17:51:01 UTC | #1
I am having issues with a simple test data action. Its an C# MVC Rest service that simply echoes back the data. The service actually executes successfully (200 OK). And if I test it in Postman it works as expected. If i test in the 'Test' tab of the 'Integrations/Actions' of pure cloud it gets a 500 error on the Flatten section (which is coming from pure cloud not the webserver) if I check Flatten. Also i noticed when you look at the 'Resolve Translation Map' part of the test, its showing { "rawResult":"null"}. Which seems to be the problem. But I am not sure why the data is not coming through pure cloud. The input/output contracts are very basic. The response config is the basic one that gets created when you create a service. The request config, has the requestTemplate set appropriately and is right when i look at the 'Resolve request body template'. I did add "Content-Type":"application/json" to the header section of the request config.
Again this works from postman and from the swagger page i have for the services. I've searched all over and have not been find much help on this.
Greg_Cunningham | 2017-12-04 13:57:22 UTC | #2
If you include results of your test action without flatten, and an example of the reponse you normally get in postman, I will see if an spot anything that would cause this.
Jbowes | 2017-12-04 14:53:52 UTC | #3
Greg,
I have now gotten a steady result where its actually failing on the Execute. It seems if I have an object that gets passed in the request body I get a 500.
Here is the reqyest config (for security reasons i have to scrub the hostname).
{ "requestUrlTemplate": "https://xxxxxx.com/PureCloudServices/api/ChangeTestData/${input.dataid}", "requestType": "PUT", "headers": { "Content-Type":"application/json" }, "requestTemplate": "{\"TestField1\":\"${input.testfield1}\",\"TestField2\":\"${input.testfield2}\",\"TestFieldTypeId\":${input.testfieldtypeid},\"TestField3\":\"${input.testfield3}\"}" }
here is the resolved request body template:
"{\"TestField1\":\"xxx\",\"TestField2\":\"yyy\",\"TestFieldTypeId\":2,\"TestField3\":\"zzz\"}"
Now if I cut and past that resolved body template into Postman if fails, but if I put this in postman is doesn't:
{ "TestField1": "string", "TestField2": "string", "TestFieldTypeId": 0, "TestField3": "string" }
Is purecloud passing the quoted string and escaped quotes in the body?
Jbowes | 2017-12-04 15:35:27 UTC | #4
Greg,
I believe I have solved this. It seems that this is a deserialization issue when having Object input parameters. If I take out the object input parameters and call the deserializer in the code it works. as expected. Will continue to look into this to see why the input parameters are not deserializing properly.
Jeff
system | 2018-01-04 15:36:15 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 2174