background image

Lantronix  

LSS2200-8P API User Guide  

33863  Rev. A                                          

https://www.lantronix.com/

  

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>' 

 

 

Summary of Contents for LSS2200-8P

Page 1: ...LSS2200 8P Managed Layer 2 Gigabit Ethernet PoE Switch 8 10 100 1000Base T IEEE 802 3bt 2 10G 5G 2 5G 1G SFP Multi Gig Slots REST API User Guide Part Number 33863 Revision A October 2022...

Page 2: ...1 800 260 1312 or Email https www lantronix com technical support Sales Offices For a current list of our domestic and international sales offices go to www lantronix com about contact Disclaimer All...

Page 3: ...antronix com 3 Contents 1 Introduction 4 Product Description 4 About This Manual 4 Related Manuals 4 LSS2200 8P REST API 4 Path Structure 5 Using and Testing 5 To use the built in Swagger UI client 5...

Page 4: ...information is provided in this document Connecting to the API Logging in to the API Browsing and interacting with the API endpoints through the built in OpenAPI Swagger client Obtaining the API schem...

Page 5: ...s swagger ui or any command line HTTP web service such as Curl https curl se or Postman https www postman com To use the built in Swagger UI client For the LSS2200 8P REST API Swagger presents a butto...

Page 6: ...o 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...

Page 7: ...e is changed subsequent REST requests may return an unauthorized response as shown below If that occurs the client must logout and log in again to continue using the REST API 1 POST https 192 168 0 20...

Page 8: ...Discovery Suite 250 Irvine CA 92618 USA Toll Free 800 526 8766 Phone 949 453 3990 Fax 949 453 3995 Technical Support Online https www lantronix com technical support Sales Offices For a current list o...

Reviews: