cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1510
Views
5
Helpful
2
Replies

FMC Rest API hit count

Luis Seyler
Level 1
Level 1

Hi! I've been trying to get a REST API call to work with no luck, I wanted to get the hit counts for all rules in an ACP, I see that I need to give a Device ID but I've tried the FTD HA Pair ID, and just the devices ID and evertime I get device Id is invalid so I'm wondering if my ID is really wrong or if its a problem with the request.

 

Here is the request I'm doing

Device ID

{
"id": "210a246a-e468-11e8-bd5d-8ecb5cb2c3a9",
"type": "Device",
"links": {
"self": "https://x.x.x.x/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/devices/devicerecords/210a246a-e468-11e8-bd5d-8ecb5cb2c3a9"
},
"name": xxxxx

REQUEST - https://x.x.x.x/api/fmc_config/v1/domain/global/policy/accesspolicies/780CF067-649A-0ed3-0000-042949674015/operational/hitcounts?filter="deviceId:{d10e2c32-ffbe-11e8-9e90-9055102fe195};fetchZeroHitCount:{false}"

 

For HA Pair

"items": [
{
"id": "d10e2c32-ffbe-11e8-9e90-9055102fe195",
"type": "DeviceHAPair",
"links": {
"self": "https://x.x.x.x/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/devicehapairs/ftddevicehapairs/d10e2c32-ffbe-11e8-9e90-9055102fe195"
},
"name": xxxxx

REQUEST - https://x.x.x.x/api/fmc_config/v1/domain/global/policy/accesspolicies/780CF067-649A-0ed3-0000-042949674015/operational/hitcounts?filter="deviceId:{d10e2c32-ffbe-11e8-9e90-9055102fe195};fetchZeroHitCount:{false}"

 

Got the same response using explorer

{
    "error": {
        "category""FRAMEWORK",
        "messages": [
            {
                "description""deviceId value is invalid."
            }
        ],
        "severity""ERROR"
    }
}
2 Accepted Solutions

Accepted Solutions

jarsmith
Cisco Employee
Cisco Employee

I don't have a good setup for testing this but I found on my box when I had the curly braces around the device ID I saw the same problem you are hitting.  When I removed that I don't see the same error about device ID.  

 

I just did a filter like this:

 

deviceId:7ed2e4e2-590e-11ec-83fb-86a1d0ba83f9

 

I see the design document had a similar example so I think the curly braces are more just to separate in the documentation but shouldn't be passed from what I can tell.

View solution in original post

That was it! Thank you so much! and it was so simple hahahaha

View solution in original post

2 Replies 2

jarsmith
Cisco Employee
Cisco Employee

I don't have a good setup for testing this but I found on my box when I had the curly braces around the device ID I saw the same problem you are hitting.  When I removed that I don't see the same error about device ID.  

 

I just did a filter like this:

 

deviceId:7ed2e4e2-590e-11ec-83fb-86a1d0ba83f9

 

I see the design document had a similar example so I think the curly braces are more just to separate in the documentation but shouldn't be passed from what I can tell.

That was it! Thank you so much! and it was so simple hahahaha