cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4609
Views
35
Helpful
20
Replies

Make REST Call??? CCX 10.6,1

Mark Verwey
Level 1
Level 1

Working on a new project that will require pulling information from a database via an API.  The way this "should"work is that when a call comes in, the script grabs the ANI/CLID information and then makes the initial call to the API to see if the callers number is in the database, and if that is true then pull additional information about them like account number, zip code, and name.  Depending on the option they choose it will need them to verify this additional information by entering it through their telephone keypad.  If they are able to verify at least 2 additional items, then allow them to hear their account balance or change/set the pin associated with their account.  I have attempted to setup the "Make Rest Call" in the editor.  I have the URL, and  but not sure what I'm doing and other than the URL, I haven't got a lot of time to get this working.  If anyone can point me in the correction it would be most appreciated.

20 Replies 20

Mark Verwey
Level 1
Level 1

I am attempting this on my own, and have tried several things things in the properties of the Make REST Call.  According to the developer that wrote the API, the script wont need a userid/pw to talk to it.  I have tried leaving those fields blank but get the error User ID Lexical Error "Unable to parse expression; no formula entered (line1, col: 1).  If I create String variables for both of them and leave them blank it allows me to save the properties.  Is this going to work?

Just put empty double quotes in both parameters; no need to create variables.

I'm 90% certain you shouldn't put a String literal in these fields, and Cisco mentioned that somewhere: documentation, forum post, or Spark room. That's the trouble with so many channels of communication, finding information. I'll see if I can get a Cisco person to look at this post and comment.

 

UPDATE: It's just for the Response fields (Response, Status Code, Status Detail).  The Request fields can be empty String literals.  Well, not the URL one of course.  :P

 

In the meantime, I'd like to share what I do, as an option for anyone else looking at this post and not wanting to create 8 new variables for their Make REST Call step; it uses a single String Array.

uccx-make-rest-call-example-with-string-array.png

 

EDIT: 2020-04-09

I was looking for an easy copy paste of the template value for my own REST String array, but since I only showed a picture, it was impossible to copy. So, here's a text form of it as well.

 

new String[] {

	// HTTP Request Section
	
		// Index 0 - Request URL
		"",
		
		// Index 1 - Basic Auth Username
		"",
		
		// Index 2 - Basic Auth Password
		"",
		
		// Index 3 - Content-Type Header
		"",
		
		// Index 4 - Body Payload for POST/PUT Requests
		"",
		
	// HTTP Response Section
	
		// Index 5 - Response Body
		"",
		
		// Index 6 - Status Code
		"",
		
		// Index 7 - Status Detail
		""
		
}

Thanks for your assistance, however not sure where to enter the "new String { "variables and do I also need to create variables in the script and if they arent String values, what should they be.

Oops!  I assumed you knew what that was hinting at.

 

Does this help?

 

uccx-script-string-array-example.png

Thanks for the clairification.  I have written many scripts but none involving a rest call to an API.  I am still working with the API team to get this working, once I have more information on this I will update this post.

Looking at this a lot closer I think I follow the logic here, but still a bit of confusion on my end.  If when I make the REST Call, I need to read data from multiple fields in the DB, can I do this in 1 step or does it require multiple rest call statements.  I need to use the ANI as the initial lookup, then when it does the API call get the following values: alias, dob, and zipcode.  Also, if it doesn't find the ANI when it makes the call, I need to set another flag so that the call is sent into a different area/queue.

Now I understand what you have been talking about, guess I needed to stop looking at it so closely.  I used your guide to setup the REST variable, when I click the apply button in the editor I get an error "Unable to parse expression; (line 27, col 5).  This is the end of the file, is it supposed to have something after the double quotes?

Figured out the issue, forgot the last line of }.  Now I think it should work.

I'm glad you got it figured out!

Now Im a little confused, I needed to do another Make REST call in one of the subflows.  I followed the same format as the first one, changed the name of the String[] variable with no issues, then went to setup the properties for the Make REST call and it fails every time on the first line at the end of the name(0) stating "Unable to parse expression; Counldn't repair and continue parsing on token #LPAREN'('(line 1, col: 5)

 

Any idea what this error means?

Reads like a syntax error.  Paste the variable contents here or a full screenshot showing it all.

Attached are the  variable and the Rest Call with error

Here is the rest of the variable string array:

new String[] {
// HTTP Request Section

// Index 0 - URL
"http://loyaltyivrqa/api/IVR/validateUser",

// Index 1 - User ID
"",

// Index 2 - Password
"",

// Index 3 - Content-Type
"application/json",

// Index 4 - Body

// HTTP Response Section

// Index 5 - Response
"",

// Index 6 - Status Code
"",

// Index 7 - Status Detail
""
}

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: