04-22-2020 08:08 AM - edited 04-22-2020 08:15 AM
Hello,
As per the programming the Cisco UCCE Developer Guide 11.6.1 the agent information can be fetched using the search criteria agentId. I tried many different combination of the search string but could not get anything specific to the agentId
e.g agentId (which is PeripheralNumber) = 24050, SkillTargetId = 28889
Working if we search based on skillTargetId
https://<server>/unifiedconfig/config/agent/28889
However, our requirement is that we want to search with agentId and tried different search string but it does not work
https://<server>/unifiedconfig/config/agent?q=24050 (it returns the result based on username)
https://<server>/unifiedconfig/config/agent?q=include:(24050) (it returns the entire list of agent)
https://<server>/unifiedconfig/config/agent?agentId=24050 (it returns the entire list of agent)
May I know the URL with search criteria with agentId
Thanks in advance.
Rohit
04-22-2020 11:15 AM
Hi Rohit,
In PCCE 11.6(3) to find agent details using Agent API and agentId as a search criteria I use the following URL:
{{api_protocol}}://{{api_server}}/unifiedconfig/config/agent?q=1324
Where 1324 is the agent ID. Here is a screen from Postman and the results, that I received:
The Developer guide says that when you use the q= parameter then you will start a search using basic parameters for the object. For agents, this set is:
When the search is performed, the system is using "Contains" clause.
Documentation reference: Link
04-22-2020 12:45 PM
Hi Marek, first of all thank you for response.
Looks like your environment is PCCE but mine is UCCE. Most likely the api should work the same way but in my case it is returning 8 results that is containing the search string in username
https://<server>/unifiedconfig/config/agent?q=24050 (it returns the result based on username)
I have attached the response I am getting
04-22-2020 01:13 PM
Thanks for the image - it shows everything.
In your system, you have agents that have first name that contains the search string. The system will show all the records that contain this string checking all the basic parameters.
I think this might work for you:
https://<server>/unifiedconfig/config/agent?q=24050 include:(24050) or
https://<server>/unifiedconfig/config/agent?q=24050 include:24050
Can you try this out?
04-22-2020 05:00 PM
04-22-2020 11:11 PM
Rohit,
I did some research and finally, it looks like a bug. At this stage, I'm not sure if it's a bug in the API ort in the documentation. Let me explain.
First of all, I was able to reproduce the issue in my PCCE lab. What I've done, is I've created 3 agent objects:
First of all, I've tested the following query:https://<server>/unifiedconfig/config/agent?q=1324
As a result, I've got 3 objects that I've in my system (mentioned above).
Then to exclude the objects with the first name and last name I've used the include keyword creating the following query URL: :https://<server>/unifiedconfig/config/agent?q=1324 include:(1324) - the same query that I've posted in my last response.
As a result, I've also received the all 3 objects although I've expected only one.
So what I've done, is I've increased the unifiedconfig application logs and put them to the debug level (C:\icm\tomcat\webapps\unifiedconfig\WEB-INF\classes\conf) and flipped the server so the application can read the config parameters. Once everything was up and running, I've done the test again.
A quick look at the log showed the API fetches the data directly connecting to the database. The query that is used is created dynamically based on the passed parameters. So the REST query: https://<server>/unifiedconfig/config/agent?q=1324 include:(1324) will resolve in the following query (important parts are highlighted with red):
select top 25
this_.SkillTargetID as SkillTar1_1_12_, this_.ChangeStamp as ChangeSt2_1_12_, this_.Deleted as Deleted3_1_12_, this_.PeripheralNumber as Peripher4_1_12_, this_.AgentStateTrace as AgentSta5_1_12_, this_.ConfigParam as ConfigPa6_1_12_, this_.DepartmentID as Departm14_1_12_, this_.Description as Descript7_1_12_, this_.EnterpriseName as Enterpri8_1_12_, this_.PeripheralID as Peripher9_1_12_, this_.PeripheralName as Periphe10_1_12_, this_.PersonID as PersonI16_1_12_, this_.SupervisorAgent as Supervi11_1_12_, this_.TemporaryAgent as Tempora12_1_12_, this_.UserDeletable as UserDel13_1_12_, this_.AgentDeskSettingsID as AgentDe17_1_12_, this_.DefaultSkillGroup as Default15_1_12_, this_1_.AgentTeamID as AgentTea2_9_12_, this_2_.UserGroupID as UserGrou1_82_12_,
(select mh.MachineHostID from Machine_Host as mh inner join Machine_Address as ma on ma.MachineHostID = mh.MachineHostID inner join Machine_Service as ms on ms.MachineAddressID = ma.MachineAddressID inner join Logical_Interface_Controller as lic on lic.EnterpriseName = ms.ServiceUri inner join Peripheral as p on p.LogicalControllerID = lic.LogicalControllerID where mh.MachineType = 38 and ms.ServiceType = 13 and p.PeripheralID = this_.PeripheralID) as formula26_12_, datacenter2_.MachineHostID as Mac
hineH1_53_0_, datacenter2_.MachineName as MachineN7_53_0_, department7_.DepartmentID as Departme1_36_1_, department7_.EnterpriseName as Enterpri5_36_1_, peripheral3_.PeripheralID as Peripher1_61_2_, peripheral3_.EnterpriseName as Enterpri2_61_2_, person4_.PersonID as PersonID1_63_3_, person4_.ChangeStamp as ChangeSt2_63_3_, person4_.Deleted as Deleted3_63_3_, person4_.DepartmentID as Departm12_63_3_, person4_.Description as Descript4_63_3_, person4_.Password as Password5_63_3_, person4_.FirstName as FirstNam6_63_3_, person4_.LastName as LastName7_63_3_, person4_.LoginEnabled as LoginEna8_63_3_, person4_.SSOEnabled as SSOEnabl9_63_3_, person4_.LoginName as LoginNa10_63_3_, person4_.LoginNameShadow as LoginNa11_63_3_, department10_.DepartmentID as Departme1_36_4_, department10_.EnterpriseName as Enterpri5_36_4_, agentdesks11_.AgentDeskSettingsID as AgentDes1_3_5_, agentdesks11_.EnterpriseName as Enterpr13_3_5_, agentdesks11_.DepartmentID as Departm29_3_5_, department12_.DepartmentID as Departme1_36_6_, department12_.EnterpriseName as Enterpri5_36_6_, skillgroup13_.SkillTargetID as SkillTar1_76_7_, skillgroup13_.EnterpriseName as Enterpri5_76_7_, skillgroup13_.DepartmentID as Departm17_76_7_, department14_.DepartmentID as Departme1_36_8_, department14_.EnterpriseName as Enterpri5_36_8_, agentteam1_.AgentTeamID as AgentTea1_8_9_, agentteam1_.EnterpriseName as Enterpri2_8_9_, agentteam1_.DepartmentID as Departme7_8_9_, department16_.DepartmentID as Departme1_36_10_, department16_.EnterpriseName as Enterpri5_36_10_, supervisor17_.UserGroupID as UserGrou1_81_11_, supervisor17_.ChangeStamp as ChangeSt2_81_11_, supervisor17_.DomainName as DomainNa3_81_11_, supervisor17_.ServiceProvider as ServiceP4_81_11_, supervisor17_.UserGroupName as UserGrou5_81_11_, supervisor17_.UserGroupType as UserGrou6_81_11_, supervisor17_.UserGuid as UserGuid7_81_11_, supervisor17_.UserName as UserName8_81_11_, supervisor17_.Description as Descript9_81_11_, supervisor17_.ReadOnly as ReadOnl10_81_11_
from
Agent this_
left outer join Agent_Team_Member this_1_ on this_.SkillTargetID=this_1_.SkillTargetID
left outer join User_Supervisor_Map this_2_ on this_.SkillTargetID=this_2_.AgentSkillTargetID
left outer join Machine_Host datacenter2_ on (select mh.MachineHostID from Machine_Host as mh inner join Machine_Address as ma on ma.MachineHostID = mh.MachineHostID inner join Machine_Service as ms on ms.MachineAddressID = ma.MachineAddressID inner join Logical_Interface_Controller as lic on lic.EnterpriseName = ms.ServiceUri inner join Peripheral as p on p.LogicalControllerID = lic.LogicalControllerID where mh.MachineType = 38 and ms.ServiceType = 13 and p.PeripheralID = this_.PeripheralID)=datacenter2_.MachineHostID
left outer join Department department7_ on this_.DepartmentID=department7_.DepartmentID
left outer join Peripheral peripheral3_ on this_.PeripheralID=peripheral3_.PeripheralID
left outer join Person person4_ on this_.PersonID=person4_.PersonID
left outer join Department department10_ on person4_.DepartmentID=department10_.DepartmentID
left outer join Agent_Desk_Settings agentdesks11_ on this_.AgentDeskSettingsID=agentdesks11_.AgentDeskSettingsID
left outer join Department department12_ on agentdesks11_.DepartmentID=department12_.DepartmentID
left outer join Skill_Group skillgroup13_ on this_.DefaultSkillGroup=skillgroup13_.SkillTargetID
left outer join Department department14_ on skillgroup13_.DepartmentID=department14_.DepartmentID
left outer join Agent_Team agentteam1_ on this_1_.AgentTeamID=agentteam1_.AgentTeamID
left outer join Department department16_ on agentteam1_.DepartmentID=department16_.DepartmentID
left outer join User_Group supervisor17_ on this_2_.UserGroupID=supervisor17_.UserGroupID
where
(1=1 or this_.SkillTargetID IN (1324))
and (lower(this_.PeripheralNumber) like ? or lower(this_.Description) like ? or lower(person4_.FirstName) like ? or lower(person4_.LastName) like ? or lower(person4_.LoginName) like ?) and this_.Deleted=?
order by
lower(person4_.LoginName) asc, this_.SkillTargetID asc
If we analyze the condition: we see that:
I've also done other tests adding multiple SkillTargetID's into a query using include keyword. So the include:(5000%265001) phrase was converted to this_.SkillTargetID IN (5000, 5001) but still the query used the same conditions as a previous query.
So, In my opinion, this is a bug in version 11.6 - either system bug or documentation bug.
What is funny, I did some tests with exclude keyword. And it works like a charm - removes all unnecessary objects from the response. But it doesn't work based on agent Id as stated in the documentation (as a list of excluded agent Id's) but works for SkillTargetID values.
04-23-2020 10:29 AM
Hi Marek,
Thank you for your detail response. I agree that it might be a bug.
Do you know how we can take this to Cisco?
Thanks Rohit
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