03-16-2021 10:35 AM
I'm trying to create a REST Call on UCCX using POST method and having a JSON Body. Can someone please give me an example on how to do that? And where to put the JSON body as I cannot put it in a String. I already have the content type as "application/json".
03-16-2021 05:27 PM
Is the example at the end of this post what you're looking to do?
https://community.cisco.com/t5/contact-center/uccx-rest-json-post/td-p/3071095
03-17-2021 03:51 AM
03-17-2021 03:11 AM
Hey
the restBody is a string that you format as JSON
"{'anis': "+ CallingNumber +",'dnis': "+ CalledNumber +",'callVar02': '"+ ci_Identifyer + "/" + ci_implementId +"','sessionId': "+ SessionId +"}"
Hope that helps
03-17-2021 03:49 AM
03-17-2021 04:00 AM - edited 03-17-2021 04:03 AM
You only need to create varaible for the dynamic objects (If i understand you request))
"{'serverName': 'myServer.domain.com','dnis': "+ CalledNumber +",'staticObject1': 'staticValue1','staticObject2': 'staticValue2','sessionId': "+ SessionId +"}"
And you can put it in directly in the body
03-17-2021 04:48 AM
03-17-2021 07:21 AM
03-17-2021 05:13 AM
If you take it in smaller pieces is it then working
"{'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
for debug purpose make and string variable and create the json body in a set step. Then you can see the output when it works
Hope that makes sense
11-09-2023 09:25 PM - edited 11-09-2023 09:35 PM
Hello,
I cannot get a successful response by the service with this method. It does not return a 200 response. The service asks for double quotes and we send it as single quotes on CCX side. But these methods you mentioned should work. The response from the service is as below. Do you have a suggestion?
Payload:
"{'uniqId':'string','logKey':0,'log':'string'}"
{ "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1", "title": "One or more validation errors occurred.", "status": 400, "traceId": "00-cf5517322d55a43c6bddc3b3d1fb6153-8085d6f3f5159c1e-00", "errors": { "$": [ "''' is an invalid start of a property name. Expected a '\"'. Path: $ | LineNumber: 1 | BytePositionInLine: 2." ] } }
But this way it works smoothly, this body is very complex.
Succsess Payload
"{\"uniqId\":\"string\",\"logKey\":0,\"log\":\"string\"}"
CCX - CCM Version: 11.6.2
11-10-2023 10:37 AM
More than likely it's the quotes that are causing the issue. I'll need to spin up a script where I'm parsing out double quotes for a POST request.
david
11-12-2023 11:05 PM
When we parse the double quotes, the readability of the content becomes very difficult. I don't understand how other friends above are sending json as POST...
02-09-2024 04:19 AM
I have the same issue. Did you find any solution?
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