Showing results for 
Search instead for 
Did you mean: 

Create URL Document for text only string (Not XML)

Rune Heggelund

I want to query a http page that return only a string of text. The response is not formatted with XML. Is it possible to read the value of “parameter1” containing “4321” from the Contact Center Express script?

Response (pure text):


1 Reply 1

Anthony Holloway
Cisco Employee
Cisco Employee

Getting the response body of an HTTP GET request is as easy as:

Set my_string = URL[http://my-server.local/]

Now, if the response body is formatted as a query string:  key1=value1&key2=value2, you will need to further process your results.

You can feel free to search the web for "java query string" to see if there's code out there you like, otherwise, here's one way to do it in UCCX.

/* This Set step makes the HTTP GET request to the web server and stores the response body in the String */
Set my_string = URL[http://my-server.local/]
/* This Do step takes any size query parameter and turns it into a HashMap */
/* E.g., From this: key1=value1&key2=value2; to this: map[key1] = value1, map[key2] = value2 */
Do {

    String[] pairs = my_string.split("&");     int i = 0;     int j = pairs.length;     for (; i < j; i++) {         my_map.put(pairs[i].split("=")[0], pairs[i].split("=")[1]);     } }

/* This If step checks the existance of a specific key, and if it exists, we get the value for use in our script */

If (my_map.containsKey("key1"))


          /* The specified key is in the map, set account_number to its value */

          Set account_number = (String) my_map.get("key1");


          /* The specified key is not in the map */

I hope that makes sense and helps you.  Ask questions if you need more help.  Good luck.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

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:

Recognize Your Peers