JVC VN-E4U API Guide - Page 16

Using API that Requires Basic Authentication, 4.1. Procedure

Page 16 highlights

4. Using API that Requires Basic Authentication 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. 4.1. Procedure 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. GET Space Accept Space Host: Space Authorization: Basic API Character String Space HTTP/1.1 0x0D 0x0A text/plain or text/html 0x0D 0x0A IP Address of VN-E4 0x0D 0x0A Space User Name and Password 0x0D 0x0A 0x0D 0x0A Example The following is an example of API for acquiring the subnet mask of VN-E4. GET /api/param?network.interface.subnetmask HTTP/1.1 Accept: text/palin Host: 10.0.0.1 Authorization: Basic YWRtaW46dm4tZTQ= 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: User Name Default Password admin vn-e4 operator vn-e4 user vn-e4 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 Connection: Keep-Alive Content-Length: 80 content-type: text/plain date: Fri, 13 MAY 2005 07:33:12 GMT server: VN-E4 API Server/1.0.0 keep-alive: timeout=5, max=5 network.interface.subnetmask=255.0.0.0&200 OK 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. 16

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80

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