Showing results for 
Search instead for 
Did you mean: 


Add returned row data to REST call

Hey everyone,


I am working on a CVP application that will return results from a SQL query and then send the returned row result(s) to an API.  The query is working as expected returning the following XML:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>

I am needing the results of each "SK_ID" entry to be fed into the following API:



There may be varying results per query and won't be a set returned number every time.  I have a local variable set to parse XML via XPath but not sure where to go from there.  XPath is as follows:


var xml = {Data.Element.Agent Skill Lookup.resultSet};
var ctr = {Data.Element.ctRows.count};
var path = "/Results/Row[" + ctr + "]/SK_ID";
XPathUtil.eval(xml , path);

Any help would be appreciated. 





For anything like this, that's more complicated than simple logic, I like to make a custom Java node and put all of my data processing logic in that class.

So which part do you need help with: setting up the java class, the logic, or integrating?

Thank you for the response @Quigath.  I am by no means a Java expert so would be hesitant in developing any custom classes (honestly have no clue where to start on that).  From a support perspective if something were to break I would also not have the know how to support/troubleshoot it.  If this would be the only solution I can certainly give it a go, however would not be my first option.  Can you advise why this method would be the best?  What does this class do that the built in elements could not?      


I come from a Java/programming background so I suppose it's the first thing I think of. If there's any sort of data processing to do, it's much easier for me in plain java code rather than trying to get the gui and javascript to do the job instead.

From a software development perspective, having separate Java classes makes them easier to test and organize in source control too. The ones from Call Studio are harder to get a handle on.

Call Studio nodes are just specific Java class objects behind the scenes.

I tried to do almost exactly what you're trying to do: parse xml and send data to a webservice. I assumed that since it's what Call Studio provides that it must, somehow, be a better option. Usually, it isn't. Here I am several years later, still developing CS applications; now though, I assume that every project will be a mix of built-in and custom java nodes.

Unless there is a better way to do this I was able to get this working by the following call flow:


Here are the steps:

  • (DB_AgentLookup) SQL query returns results saved in <dbname>.xml_resultset
  • (ctRows) Counter with increment setting of 1 (starting at 0)
  • (ParseResults) Xpath that evaluates the xml_resultset element and the results path that auto increments the counter
  • (REST POST) API POST to webservice
  • (CTR Less than ReturnedResults) Run through all results and end when complete

If anyone has a better way to do this I would be interested in learning.  Note this is not the final call flow and will be tweaking to pass ICM variables for a more dymanic SQL query.


Recognize Your Peers
Content for Community-Ad