Lantronix
LSS2200-8P API User Guide
5
Path Structure
The path (URI) structure for each endpoint is:
<protocol>://<mgmt_ip>:<rest_port>/<api_prefix>/<resource>
, where:
<protocol>
http
<mgmt_ip>
the management logical interface IP address on the switch
<rest_port>
REST listening port, currently fixed at 8000 (eventually configurable)
<api_prefix>
identifies the schema:
rest/v1/
<resource>
a managed entity class or instance within a namespace (e.g.,
sysinfo
for system information,
/user/{username}
for requests on a specified user account)
Examples (LSS2200-8P REST API):
•
GET https://172.17.0.2:8000/rest/v1/sysinfo
- gets system info
•
GET https://172.17.0.2:8000/rest/v1/users
- gets the list of all configured user accounts
•
PUT https://172.17.0.2:8000/rest/v1/user/john
<plus header and data blocks> - create a user
account with username "john"
Using and Testing
The LSS2200-8P Web UI uses the LSS2200-8P REST API to interact with the management layers.
It is also possible to interact directly with the LSS2200-8P REST API using the built-in Swagger UI
https://swagger.io/tools/swagger-ui/
) or any command line HTTP web service, such as Curl (
) or
Postman (
To use the built-in Swagger UI client
For the LSS2200-8P REST API, Swagger presents a button for each resource (e.g., `
sysinfo
`). Clicking on a
resource expands to show a button for each method supported for that resource. After clicking on the resource
and method you want to use, click "Try it out".
If data is required (typically JSON format), Swagger shows a form field and usually shows an example of valid
data. Type over the values in the example, taking care not to change field names. Certain endpoints also require
a user-provided identifier in the path. For example, the `
user/{username
}` endpoints require a valid username to
be entered. When the form fields are complete, click the "Execute" button.
In a Web browser that can access your device, navigate to the base path of the schema you want to use --
https://192.168.60.1:8000/rest/v1/
for the LSS2200-8P REST API version 1.
Swagger generates and sends a curl request to the server and then presents the response received from the
server. The response includes an HTTP status code (see IETF
) and relevant content, where content
may be data or a message, depending on the endpoint and the outcome of the request.