10-08-2025 12:32 AM
Hi Community,
how can i use the Object Store URL below on the same APIC Command Line interface?
/api/node/class/mcpRtMcpIfPol.json?query-target-filter=and(wcard(mcpRtMcpIfPol.dn,"usrv"))&order-by=mcpRtMcpIfPol.modTs|desc
So i know a bit how to create moquery but sometimes it is easier to navigate to an object in APIC GUI , Open in Object Store Browser, do some filtering and then I want to use this on CLI to do some more grepping or just create a nice list.
Solved! Go to Solution.
10-14-2025 01:12 AM
Hello @RedNectar
I managed to get some output after searching some Cisco documentation.
There is a note in the document, and adding the port is giving the correct output.
Note: Port 7777 is specifically used to allow the APIC to query itself.
apic:~> icurl -s 'http://localhost:7777/api/class/mcpRtMcpIfPol.json?query-target-filter=wcard(mcpRtMcpIfPol.dn,"usrv")&order-by=mcpRtMcpIfPol.modTs|desc' | jq
{
"totalCount": "100",
"imdata": [
{
"mcpRtMcpIfPol": {
"attributes": {
"childAction": "",
"dn": "uni/infra/mcpIfP-mcp_enabled/rtinfraMcpIfPol-[uni/infra/funcprof/accportgrp-server1234]",
"lcOwn": "local",
"modTs": "2024-07-11T18:25:43.107+02:00",
"status": "",
"tCl": "infraAccPortGrp",
"tDn": "uni/infra/funcprof/accportgrp-server1234"
}
}
}
Thanks for you answers and i will check out more on your website regarding icurl and moquery.
Have a great day!
10-08-2025 01:51 AM - edited 10-08-2025 03:17 AM
Hi @Headhunter ,
Sounds like you need to learn how to use icurl
There are some good blog posts out there to help, some of which I've written. Make sure you include the quoted word "rednectar" in your search - although a simple search for icurl aci will probably do if you use Google.
In the meantime, try this at the APIC CLI
apic1# bash ;#To get to bash so you can enter a ? in the command
admin@apic1:~> icurl -ks "http://localhost/api/class/mcpRtMcpIfPol.json?\
query-target-filter=wcard(mcpRtMcpIfPol.dn,\"usrv\")&order-by=mcpRtMcpIfPol.modTs|desc" | jq
You can them play with "grepping" (as you say), or learn how to manipulate the output from jq to do some fancy stuff.
10-09-2025 08:08 AM
Hi @RedNectar ,
thanks so far, but i don't get any results. Also checked your website and tried the one below and no output as well.
icurl -s http://localhost/api/node/class/fvAEPg.json | jq
I am in bash mode apic:~>
10-09-2025 01:11 PM
Hi @Headhunter ,
No output for icurl -s http://localhost/api/node/class/fvAEPg.json would mean you have no fvAEPg objects. In other words, no Application End Point Groups. Put simply, no EPGs
And you would expect the same from moquery -c fvAEPg
The filter through jq simply makes the output of the icurl readable.
So I'm not sure why you get no output (assuming you DO have EPGs and the commands are entered on an APIC rather than a leaf)
And it seems if you can't get past this point, you won't be able to refine the output to filter just the EPGs that contain the letters "usrv" etc from the GUI either (as per the original request) - after all, the only thing I did was take your original GUI URI and turn it into a format that icurl would understand by escaping the quotes characters and enclosing the whole lot in quotes. In fact I could have done it this way - enclosing your entire URI in single quotes, which I guess is closer to your original:
apic1# bash ;#To get to bash so you can enter a ? in the command
admin@apic1:~> icurl -s 'http://localhost/api/class/mcpRtMcpIfPol.json?query-target-filter=wcard(mcpRtMcpIfPol.dn,"usrv")&order-by=mcpRtMcpIfPol.modTs|desc' | jq
But when using single quotes, you can't spread the command across two lines unless you enclose each section in single quotes.
admin@apic1:~> icurl -s 'http://localhost/api/class/mcpRtMcpIfPol.json?'\
'query-target-filter=wcard(mcpRtMcpIfPol.dn,"usrv")&order-by=mcpRtMcpIfPol.modTs|desc' | jq
And of course you noticed that I didn't need the -k switch on icurl because I was using http: rather than https:
10-14-2025 01:12 AM
Hello @RedNectar
I managed to get some output after searching some Cisco documentation.
There is a note in the document, and adding the port is giving the correct output.
Note: Port 7777 is specifically used to allow the APIC to query itself.
apic:~> icurl -s 'http://localhost:7777/api/class/mcpRtMcpIfPol.json?query-target-filter=wcard(mcpRtMcpIfPol.dn,"usrv")&order-by=mcpRtMcpIfPol.modTs|desc' | jq
{
"totalCount": "100",
"imdata": [
{
"mcpRtMcpIfPol": {
"attributes": {
"childAction": "",
"dn": "uni/infra/mcpIfP-mcp_enabled/rtinfraMcpIfPol-[uni/infra/funcprof/accportgrp-server1234]",
"lcOwn": "local",
"modTs": "2024-07-11T18:25:43.107+02:00",
"status": "",
"tCl": "infraAccPortGrp",
"tDn": "uni/infra/funcprof/accportgrp-server1234"
}
}
}
Thanks for you answers and i will check out more on your website regarding icurl and moquery.
Have a great day!
10-14-2025 03:30 AM
Hi @Headhunter ,
Darn. I'd forgotten about port 7777 - pretty sure that port 80 has been supported for that last few versions as well as 7777, so I've rarely had to use it
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