02-22-2018 05:09 PM - edited 02-21-2020 10:46 AM
I'm trying to use the ISE ERS to create a networkdevice (ISE 2.2). Any hints debugging a "405 Method Not Allowed" response? I'm guessing my JSON data is bad, but a pointer to what is wrong would be very helpful.
02-23-2018 07:30 AM
Reading through the error details:
The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.
I'd suggest you to match your ERS query with this document:
https://www.network-node.com/blog/2016/4/19/ise-rest-api-goodbye-click-click-click-click-part-2
02-23-2018 04:05 PM
I tried the create network device group example in https://www.network-node.com/blog/2016/4/19/ise-rest-api-goodbye-click-click-click-click-part-2 and still get a 405 Method Not Allowed.
Here is my script:
#! /usr/bin/perl
# Create a network device group in Cisco ISE
use warnings;
use strict;
use LWP::UserAgent;
use Data::Dumper;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; # Do not check SSL certs
my $myname = $0;
$myname =~ s/.*\///;
my $username = shift;
my $password = shift;
my $hostname = shift;
die "Usage: $myname username password hostname" unless ($username && $password && $hostname);
my $url = "https://${username}:${password}\@${hostname}:9060/ers/config/networkdevicegroup";
my $group_xml = '
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns4:networkdevicegroup
description="Campus Switches"
id="000000011"
name="Device Type#All Device Types#Switches"
xmlns:ers="ers.ise.cisco.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns4="network.ers.ise.cisco.com">
<type>Device Type</type>
</ns4:networkdevicegroup>
';
my $ua = LWP::UserAgent->new;
$ua->agent("$myname/1.0 ");
$ua->default_header('Accept' => 'application/xml');
$ua->default_header('Content-Type' => 'application/vnd.com.cisco.ise.identity.internaluser.1.0+xml;charset=UTF-8');
my $res = $ua->put($url,Content => $group_xml);
if (!$res->is_success) {
die "Update using $url failed with: ".$res->status_line;
}
print Dumper($res->content);
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