10-19-2022 11:09 AM - edited 10-19-2022 11:23 AM
I am doing a Make REST Call I am having trouble getting the SSN variable into the string . So my app ask for the numberSS as a Get Digit String and that works perfect as when I run in Debug I see the variable populated.
Now here is the body
u"{\"callname\":\"JNSPBILL\",\"ssn\":\+ numberSS\,\"db_nbr\":\"488\"}"
Now when I run the debug the word numberSS is still in the body and then I get a not on file and the ssn is all zeros .
When I set the body to a parameter in my system and set it up as this
u"{\"callname\":\"JNSPBILL\",\"ssn\":\"111222333\",\"db_nbr\":\"488\"}"
it works fine. So, my question is the proper way of inserting a variable into the string prior to sending it.
Attached is the Make REST Call screen shot. I know the rest call works its the variable that is the issue
Thanks in advance
Allan
Solved! Go to Solution.
10-21-2022 06:57 AM
Thanks to all here as I am new to the Cisco world coming from Avaya and Aspect and other switches. Our issue was we are going from UCCX platform to a Linux platform and all these different rules on double quote's and backslashes. What we was set up the string to accept the variable then built around it until the JSON parser accepted it . We used Debug and evaluate to figure it out . the result looked like this below. numberSS is the variable and it works fine.
I truly appreciate all the assistance and look forward to more interactions
Allan
U"{\"callname\": \"JNSPBILL\",\"ssn\": " + numberSS + U",\"db_nbr\": \"488\" }"
10-21-2022 03:28 AM - edited 10-21-2022 03:28 AM
A variable name will be treated as text characters if within double quotation marks. You will need to break the string into pieces and concatenate it together. For example, “foo” + stringVariable + “bar”
10-21-2022 06:09 AM
Jonathan is 100%. Here's an example in JS doing a very similar thing.
var delta = nowDate.getTime()-callStartDate.getTime();
ctrString = '{"CALABRIO_REDACT":"[0000,'+delta+']"}';
david
10-21-2022 06:57 AM
Thanks to all here as I am new to the Cisco world coming from Avaya and Aspect and other switches. Our issue was we are going from UCCX platform to a Linux platform and all these different rules on double quote's and backslashes. What we was set up the string to accept the variable then built around it until the JSON parser accepted it . We used Debug and evaluate to figure it out . the result looked like this below. numberSS is the variable and it works fine.
I truly appreciate all the assistance and look forward to more interactions
Allan
U"{\"callname\": \"JNSPBILL\",\"ssn\": " + numberSS + U",\"db_nbr\": \"488\" }"
10-21-2022 07:05 AM
CCX is basically Java (not JavaScript). The CRS Editor and steps in the palette are a GUI abstraction/representation of Java programming. The expression editor lets you write snippets of real Java code though; heck you can even install custom Java classes on the server when necessary. When in doubt how to do something custom in the CRS Editor, I just Google for how to do it in Java; there are usually a bunch of results. In this case, "how do I concatenate strings in Java" would get you an answer. Just be careful to use answers that apply to the Java version appropriate to your CCX version; it's listed in the compatibility matrix.
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