Lantronix
LSS2200-8P API User Guide
6
Using Command Line Clients (curl, postman)
Curl examples with data fields
Note
: Login is required, so you must set the authentication header using the "Bearer <key>" string obtained
above in the Authentication section. Example:
-H 'Authorization: Bearer
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYyMTQ2MjkzMywianRpIjoiNz
ZjOGRmYzUtYjE1MS00MGU3LTk2MGUtMjgwNTFjZDI4NzA4IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6ImFkbWluIiwib
mJmIjoxNjIxNDYyOTMzLCJleHAiOjE2MjIwNjc3MzN9.dPSzHvnlLkytxCx1xv3VPn3WDTwJp8QlH2r9AiVeZVM'
Some endpoints require a trailing '/' in the URL when using curl, but not in Swagger UI. Curl will return a
redirection error if an expected trailing '/' is omitted.
Resource: sysinfo
curl -k -X 'GET' 'https://172.17.0.2:8000/rest/v1/sysinfo/' -H 'accept:
application/json' -H 'Authorization: Bearer <key>'
curl -k -X 'POST' 'https://172.17.0.2:8000/rest/v1/sysinfo/' -H 'accept:
application/json' -H 'Authorization: Bearer <key>' -H 'Content-Type:
application/json' -d '{"SYSNAME": "NewName", "LOCATION": "New Place", "CONTACT":
"Someone Else"}'
Resource: banner
curl -k -X 'GET' 'https://172.17.0.2:8000/rest/v1/banner/' -H 'accept:
application/json' -H 'Authorization: Bearer <key>'
curl -k -X 'POST' 'https://172.17.0.2:8000/rest/v1/banner/' -H 'accept:
application/json' -H 'Authorization: Bearer <key>' -H 'Content-Type:
application/json' -d '{"BANNER": "New login banner"}'
Resource: users
curl -k -X 'GET' 'https://172.17.0.2:8000/rest/v1/users/' -H 'accept:
application/json' -H 'Authorization: Bearer <key>'
Resource: user/{username}
curl -k -X 'GET' 'https://172.17.0.2:8000/rest/v1/user/bob' -H 'accept:
application/json' -H 'Authorization: Bearer <key>'
curl -k -X 'PUT' 'https://172.17.0.2:8000/rest/v1/user/bob' -H 'accept:
application/json' -H 'Authorization: Bearer <key>' -H 'Content-Type:
application/json' -d '{"PASSWD": "abcdef", "ENABLED": "true", "GROUP": "config"}'
curl -k -X 'POST' 'https://172.17.0.2:8000/rest/v1/user/bob' -H 'accept:
application/json' -H 'Authorization: Bearer <key>' -H 'Content-Type:
application/json' -d '{"GROUP": "readonly"}'
curl -k -X 'DELETE' 'https://172.17.0.2:8000/rest/v1/user/bob' -H 'accept:
application/json' -H 'Authorization: Bearer <key>'