Legacy Dev Forum Posts

 View Only

Sign Up

Fetch site skill from User ID in Data Action

  • 1.  Fetch site skill from User ID in Data Action

    Posted 06-05-2025 18:43

    Nishant_Tank | 2022-11-17 19:19:42 UTC | #1

    Hi Folks This is my first post on this forum .. so apologies if my post does not confirm to the standards here.

    In our environment, we have a skill assigned to every agent that represents the site he/she works at. The skill name has syntax as "ccregionsite".

    Apart from the site skill, agents also have few other skills.

    Using a Data Action, we want to extract the name of the site skill for an agent. For this, I believe we will have to use below API: /api/v2/users/{userId}/routingskills

    The output I am receiving is the entire list of skills assigned to the userid. Is there a way to only extract the name of skill that begins with "cc" as output for the data action using above API? Or can the output be filtered to only choose the site skill (i.e. skill starting as "cc_")?


    78692638d4a24645fbf5 | 2022-11-18 14:03:00 UTC | #2

    Hi Nishant,

    Yes, that is where you can use some special Json Path syntax (reference this guide https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html) to extract only the values you want. In my example, I am executing a request and retrieveing the following skills for my user:

    { "entities": [ { "id": "52b8a811-1e38-4afb-872a-0804d2eb42cf", "name": "30 days Past Due", "proficiency": 0, "state": "active", "skillUri": "/api/v2/routing/skills/52b8a811-1e38-4afb-872a-0804d2eb42cf", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/52b8a811-1e38-4afb-872a-0804d2eb42cf" }, { "id": "9d627e91-45ad-43ee-8770-c36be5a7d836", "name": "Agent Skill 1", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/9d627e91-45ad-43ee-8770-c36be5a7d836", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/9d627e91-45ad-43ee-8770-c36be5a7d836" }, { "id": "634b5b45-3930-4388-9a99-a281ed74bc44", "name": "Agent 2", "proficiency": 0, "state": "active", "skillUri": "/api/v2/routing/skills/634b5b45-3930-4388-9a99-a281ed74bc44", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/634b5b45-3930-4388-9a99-a281ed74bc44" }, { "id": "bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d", "name": "PKS Skill", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d" }, { "id": "a0641c35-1d7b-4827-9c94-6ce90dda838b", "name": "TestSkill", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/a0641c35-1d7b-4827-9c94-6ce90dda838b", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/a0641c35-1d7b-4827-9c94-6ce90dda838b" } ], "pageSize": 25, "pageNumber": 1, "total": 5, "firstUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills?pageSize=25&pageNumber=1", "lastUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills?pageSize=25&pageNumber=1", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills?pageSize=25&pageNumber=1", "pageCount": 1 }

    If I want to get only the skils with "skill" in the name... I just whip up a simple translationMap that looks like so

    { "translationMap": { "skillNames": "$..entities[?(@.name contains 'Skill')]" }, "translationMapDefaults": { "skillNames": "\"EMPTY\"" }, "successTemplate": "{\n\"skillNames\": ${skillNames}\n}" }

    And I'm able to store the skill Names with the following output schema:

    { "skillNames": [ { "id": "9d627e91-45ad-43ee-8770-c36be5a7d836", "name": "Agent Skill 1", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/9d627e91-45ad-43ee-8770-c36be5a7d836", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/9d627e91-45ad-43ee-8770-c36be5a7d836" }, { "id": "bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d", "name": "PKS Skill", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/bac33bd7-0914-44d3-9ff5-c6f41d7f5d0d" }, { "id": "a0641c35-1d7b-4827-9c94-6ce90dda838b", "name": "TestSkill", "proficiency": 5, "state": "active", "skillUri": "/api/v2/routing/skills/a0641c35-1d7b-4827-9c94-6ce90dda838b", "selfUri": "/api/v2/users/ac3828b4-cb3e-41c6-b2ad-d6ba33252dc9/routingskills/a0641c35-1d7b-4827-9c94-6ce90dda838b" } ] }

    And Voila! I'm able to get what I want.


    Nishant_Tank | 2022-11-18 10:32:35 UTC | #3

    Wow - that's amazing. Will try this and confirm the outcome soon. :+1:

    Thanks a ton !!


    Nishant_Tank | 2022-11-18 14:09:12 UTC | #4

    Thanks a lot It worked for me with just a few tweaks.

    The below Response Translation Map worked for me:

    { "translationMap": { "siteSkill": "$..entities[?(@.name contains 'cc_')]" }, "translationMapDefaults": { "siteSkill":"EMPTY" }, "successTemplate": "{\"siteSkill\": ${siteSkill}}" }


    78692638d4a24645fbf5 | 2022-11-18 14:27:50 UTC | #5

    Great! Have a good day!


    system | 2022-12-19 14:28:36 UTC | #6

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 17276