cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
533
Views
0
Helpful
1
Replies

How to use ACI API query to get the totalCount of static epg members

sppandala
Level 1
Level 1

I am trying to get the totalCount of static epg members of particular EPG, How to use API to achieve this, I am getting large chunks of data instead of total count

1 Reply 1

RedNectar
VIP Alumni
VIP Alumni

Hi @sppandala ,

What query were you using to be "getting large chunks of data instead of total count" - you may just need to parse your output a bit more cleverly.

Anyway - here's an icurl  example that uses the same API, so hopefully this will put you onto the right track.  I've used jq to parse the output to make it more presentable.

In my example:

  • The tenant name is Tenant02
  • The Application Profile name is 2Tier_AP
  • The EPG name is WebServers_EPG
  • The output shows that there a 2 statically mapped endpoints in this tenant/ap/epg

Note that this command is issued at the bash prompt of the APIC - that makes it easier to type the ?  character.

apic1# bash
admin@apic1:~> icurl -k -s https://localhost/api/node/class/fvCEp.json?query-target-filter='wcard(fvCEp.dn,"uni/tn-Tenant02/ap-2Tier_AP/epg-WebServers_EPG")' | jq .totalCount
"2"

If you were sure the EPG name was unique (and not repeated in another tenant or application profile) you could simplify the API call to

admin@apic1:~> icurl -k -s https://localhost/api/node/class/fvCEp.json?query-target-filter='wcard(fvCEp.dn,"WebServers_EPG")' | jq .totalCoun

 

I hope this helps.


Don't forget to mark answers as correct if it solves your problem. This helps others find the correct answer if they search for the same problem.


RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License