Sample json response, Sample xml response, Sample error response – Brocade Network Advisor REST API Guide (Supporting Network Advisor 12.3.0) User Manual
Page 37

Brocade Network Advisor REST API Guide
23
53-1003160-01
Logging in and out
3
}
} catch (IOException ie) {
System.out.println(ie.toString());
} finally {
if (null != con) {
con.disconnect();
}
}
Sample JSON response
The following is a sample JSON response to a login request.
CALLING POST http://10.24.41.138/rest/login
Response code is 200
GOT TOKEN FROM RS RESPONSE = Yh8veQHgxR6v6KgNR9Eioeg7168=
{"serverName":"W2K8R2-41-138","serverIp":"10.24.41.138"}
Sample XML response
The following is a sample XML response to a login request.
CALLING POST http://10.24.48.103/rest/login
Response code is 200
GOT TOKEN FROM RS RESPONSE = kPkOm7PX4WempcfP7B8iZrb5RDY=
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:LoginResponse
xmlns:ns2="http://www.brocade.com/networkadvisor/webservices/v1/authservice/respo
nse"><serverName>DCM-x3650-103</serverName><serverIp>10.24.48.103</serverIp></ns2
:LoginResponse>
Sample error response
The following is a sample error response to a login request.
CALLING POST http://10.24.48.103/rest/login
Response code is 500
<html><head><title>JBoss Web/7.2.0.Final - JBWEB000064: Error
report</title><style><!--H1
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-si
ze:22px;} H2
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-si
ze:16px;} H3
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-si
ze:14px;} BODY
{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B
{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P
{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;
}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head><body><h1>JBWEB000065: HTTP Status 500 - RSException [errorCode=4005,
errorMsg=Invalid username or password]</h1><HR size="1"
noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000066: Exception
report</p><p><b>JBWEB000068: message</b> <u>RSException [errorCode=4005,
errorMsg=Invalid username or password]</u></p><p><b>JBWEB000069: description</b>
<u>JBWEB000145: The server encountered an internal error that prevented it from
fulfilling this request.</u></p><p><b>JBWEB000070: exception</b>
<pre>org.jboss.resteasy.spi.UnhandledException: RSException [errorCode=4005,
errorMsg=Invalid username or password]