07-08-2021 09:54 AM - edited 07-08-2021 03:41 PM
I am trying to pass Json variables using a POST through the body and can not seem to apply the format body fields in a way that UCCX editor will allow.
In tests using Postman we were able to make the POST with the following string in the body as raw output
{"Context":"scheduling","UserID":"mruiz2","ContactType":"Incoming","CommunicationType":"Phone","PhoneNumber":"9876543210","PatientID":{"ID":"","Type":""}}
When we try to use this in UCCX editor we get parsing errors. Any help with formatting this correctly would be greatly appreciated.
I am a noob sorry these questions are stupid.
Solved! Go to Solution.
07-09-2021 10:02 AM
My Manager found this thread and it seems to work so far.
https://community.cisco.com/t5/contact-center/uccx-rest-call-post-json-body/m-p/4308330
The last post in that thread is the one I followed.
"{'serverName': 'myServer.domain.com'}"
"{'serverName': 'myServer.domain.com','serverId' : 1,'dnis': "+ CalledNumber +", 'queue': '"+ CSQ +"'}"
Object name has to be in single qoutes
For string variable in your json use '"+ variableName + "' (single and double qoute in beginning and double and single in the end)
For int variable in your json use "+ variableName + " (double qoute in beginning and double in the end)
Static values just single for string and for int only value
I will update again once I have validated that the script actually works.
07-08-2021 10:58 AM
Hello @jeremyseielstad
I've found some format issues that could be the cause. I've used a JSON Formatter website and fixing the sintax errors I've found the following result:
{"Context":"scheduling","UserID":"RESTUID","ContactType":"Incoming","CommunicationTy":{"Context":"scheduling"},"pe":"Phone","P":{"Context":"scheduling"},"honeNumber":"CallerID","PatientID":{"ID":"","Type":""}}
Just let me know if this passes on CCX Editor and mark as solved this post if so.
Thanks.
07-08-2021 11:18 AM
Thank you for your response my first post was formatted incorrectly .
Her is what it should have read.
{"Context":"scheduling","UserID":"mruiz2","ContactType":"Incoming","CommunicationType":"Phone","PhoneNumber":"9876543210","PatientID":{"ID":"","Type":""}}
In any case I tried the result you sent me and it did not pass either. It keeps getting hung op on or after the colon at character 33 in the string.
07-08-2021 12:57 PM
Thank you for the reply I did have it formatted incorrectly. The following is what I should have posted...
{"Context":"scheduling","UserID":"mruiz2","ContactType":"Incoming","CommunicationType":"Phone","PhoneNumber":"9876543210","PatientID":{"ID":"","Type":""}}
In any case I tried your result and am getting the same error. It appears to not like the syntax at or just after the colon at character 33.
Thank again.
07-09-2021 10:02 AM
My Manager found this thread and it seems to work so far.
https://community.cisco.com/t5/contact-center/uccx-rest-call-post-json-body/m-p/4308330
The last post in that thread is the one I followed.
"{'serverName': 'myServer.domain.com'}"
"{'serverName': 'myServer.domain.com','serverId' : 1,'dnis': "+ CalledNumber +", 'queue': '"+ CSQ +"'}"
Object name has to be in single qoutes
For string variable in your json use '"+ variableName + "' (single and double qoute in beginning and double and single in the end)
For int variable in your json use "+ variableName + " (double qoute in beginning and double in the end)
Static values just single for string and for int only value
I will update again once I have validated that the script actually works.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide