16
4. Using API that Requires Basic Authentication _
4.1. Procedure
Basic authentication is required for APIs which are explained in Section 5. This section provides basic explanation of the uses of APIs that
require basic authentication.
1) The client establishes a TCP connection to port number 80.
2) The client sends out API via TCP.
Character strings of the following structure will be sent out.
The following is an example of API for acquiring the subnet mask of VN-E4.
Example
GET /api/param?network.interface.subnetmask HTTP/1.1<CRLF>
Accept: text/palin<CRLF>
Host: 10.0.0.1<CRLF>
Authorization: Basic YWRtaW46dm4tZTQ=<CRLF><CRLF>
Specify the response format by Accept line. A plain text response is returned when this is specified as text/
plain. An HTML response will be returned when text/html is specified. An HTML response will be returned
when Accept is not specified.
Restrictions are imposed on clients via basic authentication in the case of API for acquiring/setting parameters
of VN-E4. During basic authentication, user name and password shall be provided in the Authorization line.
There are 3 types of user names, namely admin, operator and user. The type of user for which use is allowed is
predetermined for each API. Join the user name and the password using a colon, Base64 encode this character
string and enter this in the Authorization line.
For example, when
User name: admin
Password: vn-e4
then the character string upon joining the user name and the password with a colon will be admin:vn-e4.
Base64 encoding this string yields YWRtaW46dm4tZTQ=. Enter this in the Authorization line. Default
passwords in the factory settings are as follows:
3) VN-E4 returns a response to the client. In the following example, current subnet mask is 255.0.0.0. In addition, 255.0.0.0 is followed by &
and 200 OK, indicating that acquisition is successful.
Example
HTTP/1.1 200 OK<CRLF>
Connection: Keep-Alive<CRLF>
Content-Length: 80<CRLF>
content-type: text/plain<CRLF>
date: Fri, 13 MAY 2005 07:33:12 GMT<CRLF>
server: VN-E4 API Server/1.0.0<CRLF>
keep-alive: timeout=5, max=5<CRLF><CRLF>
network.interface.subnetmask=255.0.0.0&200 OK<CRLF>
Note also that each of the content-type, date, server and keep-alive lines begin with a lower-case character.
4) The client can disconnect TCP80 to end the use of API.
4.1. Procedure
GET
Space
API Character String
Space
HTTP/1.1
0x0D 0x0A
Accept
Space
text/plain or text/html
0x0D 0x0A
Host:
Space
IP Address of VN-E4
0x0D 0x0A
Authorization: Basic
Space
User Name and Password
0x0D 0x0A 0x0D 0x0A
User Name
Default Password
admin
vn-e4
operator
vn-e4
user
vn-e4
4. Using API that Requires Basic Authentication