Wired Intelligent Edge (Campus Switching and Routing)

New Contributor

Trouble getting started with REST API

Hi all,


I'm trying to get started with network automation, and I'm having some issues figuring out how to use the REST API.


I've been using Postman to try to interrogate the API (i'm trying to pull VLANs with x.x.x.x/rest/v1/vlans, but every time I try to do a GET request, I get 400 bad request, the REST session timed out. Please try again.


Could this be because the switch requires a username and password?


Does anyone have any suggestions that could help me out?

Aruba Employee

Re: Trouble getting started with REST API

Can you make sure, below points are taken cared before accessing vlans?

1. REST API enabled on switch (show rest-interface).

2. REST API login to switch is successful and cookie is returned. ( you can check this thread on how to parse the credentials in Postman. http://community.arubanetworks.com/t5/Campus-Switching-and-Routing/2930M-16-04-Unable-to-Login-via-REST-API/m-p/404685 )

Login URL --> x.x.x.x/rest/v3/login-sessions

body, select 'raw' and give the JSON --> 

{"userName" : "switchusername","password" : "password"}


Once this is successful, GET command for vlans should work. 

URL what you mentioned looks good ( x.x.x.x/rest/v1/vlans)


You can also download detailed documention for switch REST API from https://support.hpe.com (attached here)


Also, try out sample python code for ArubaOS-Switch REST API  workflows at https://github.com/aruba/arubaos-switch-api-python 


Aruba Employee

Re: Trouble getting started with REST API



Can you tell which switch you are trying to access? What's the config of the switch?


Kind regards,



Search Airheads
Showing results for 
Search instead for 
Did you mean: