c# - Register Endpoint on Cisco ISE with RestSharp -


i'm trying register(post) endpoint on cisco ise 1.3 via restsharp client in c# console application.

i got working requests. code used:

string xml = "<?xml version='1.0' encoding='utf-8' standalone='yes'?> <ns3:endpoint name='name' id='id' description='desc' xmlns:ns2='ers.ise.cisco.com'    xmlns:ns3='identity.ers.ise.cisco.com'> <groupid>04f3c120-f42f-11e2-bd54-005056bf2f0a</groupid> <mac>00:00:cc:ac:bb:cc</mac> <profileid>576bf7b0-f42f-11e2-bd54-005056bf2f0a</profileid><staticgroupassignment>true</staticgroupassignment> <staticprofileassignment>true</staticprofileassignment> </ns3:endpoint> ";  var client = new restclient();     client.baseurl = new uri("https://" + ip + ":9060/ers/config/endpoint");     client.authenticator = new httpbasicauthenticator(user, pw);  var request = new restrequest();      request.method = method.post;     request.addheader("accept", "application/vnd.com.cisco.ise.identity.endpoint.1.0+xml");     request.addheader("content-type", "application/vnd.com.cisco.ise.identity.endpoint.1.0+xml; charset=utf-8");     request.addbody(xml);     request.requestformat = dataformat.xml;     request.xmlserializer.contenttype = "application/vnd.com.cisco.ise.identity.endpoint.1.0+xml; charset=utf-8";  var response = client.execute(request); 

when submit code receive "unsuported media-type" error. headers taken sdk cisco. realized curl, sharepoint , sc orchestrator.

i think there mistake in combination of xml request can't find it.

any ideas?

you need add content type in headers, same accept one:

request.method = method.get; request.addheader("accept",application/vnd.com.cisco.ise.identity.guestuser.2.0+xml"); request.addheader("content-type","application/vnd.com.cisco.ise.identity.guestuser.2.0+xml");


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -