cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1548
Views
0
Helpful
4
Replies

ISE policy API throwing error request has bad input format in the body

TheNetRunner
Level 1
Level 1

Hey all,

I am currently trying to develop a script for automating some tasks within ISE, one of those tasks involves creating a network access rule within a policy set. This is where I've hit a hurdle, when trying to create a rule I get:

{
  "message": "request has bad input format in the body",
  "code": 400
}

Which is most unhelpful. This happens even when I pass in the example from Swagger. any ideas?

Request body:

{
  "link": {
    "href": "https://ise-svr.example.com/api/v1/policy/network-access/policy-set/8bcd18db-3102-4fac-8765-1064f880cdbe",
    "rel": "self",
    "type": "application/json"
  },
  "profile": "[\"PermitAccess\",\"NSP_Onboard\"]",
  "rule": {
    "condition": {
      "conditionType": "ConditionAttributes",
      "isNegate": false,
      "link": {
        "href": "https://ise-svr.example.com/api/v1/policy/network-access/policy-set/8bcd18db-3102-4fac-8765-1064f880cdbe",
        "rel": "self",
        "type": "application/json"
      }
    },
    "default": false,
    "name": "MyRuleName_1",
    "rank": 1,
    "state": "enabled"
  },
  "securityGroup": "BYOD"
}
1 Accepted Solution

Accepted Solutions

Alexander Stevenson
Cisco Employee
Cisco Employee

Hello @TheNetRunner,

You might want to check out these for some ideas:

 

Cisco DevNet Code Exchange

https://developer.cisco.com/codeexchange/

 

Cisco DevNet Automation Exchange

https://developer.cisco.com/network-automation/

View solution in original post

4 Replies 4

Alexander Stevenson
Cisco Employee
Cisco Employee

Hello @TheNetRunner,

You might want to check out these for some ideas:

 

Cisco DevNet Code Exchange

https://developer.cisco.com/codeexchange/

 

Cisco DevNet Automation Exchange

https://developer.cisco.com/network-automation/

Hello Alexstev,

Thank you for the responses, the the pages you've linked look very interesting I shall give them a look now.

Apologies for not updating this thread sooner I realized my mistake the day after I posted this and I now have it working. I was writing the application in TS and in the end I created a bunch of interfaces to prevent myself from making mistakes in the body of the request object.

For those interested you can go to the swagger docs (https://example.com/api/swagger-ui/index.html) for the ISE server and look at the schemas below all the API resources. From the schemas it's a pretty easy process to create interfaces.

Ruben Cocheno
Spotlight
Spotlight

@TheNetRunner 

Are we good to close this?

Tag me to follow up.
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/

TheNetRunner
Level 1
Level 1

@ruban 

Yes, feel free to close this off, I was able to fix this in the end.