- Community Home
- >
- Networking
- >
- Switching and Routing
- >
- Aruba & ProVision-based
- >
- Re: REST API -
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 05:32 AM
09-02-2016 05:32 AM
REST API -
Hi all,
Has anyone managed to get the REST API on HPE ProCurve/Aruba switches (for example the 2530 series) working?
When running firmware version YA.16.02.0010 with HTTP/HTTPS web server enabled and the rest-interface feature enabled everytime I try to login to the switch (using the commands provided in this guide - http://h20565.www2.hpe.com/hpsc/doc/public/display?sp4ts.oid=5333803&docLocale=en_US&docId=emr_na-c05068466) I just get timed out error messages. This is on both the HTTP and HTTPS interfaces (and I have installed a valid cert on the HTTPS interface).
Having tried with both curl (as stated in the guide) and the Invoke-RestMethod (in PowerShell) each and everytime its the same - connection times out.
Anyone have any thoughts? Verbose and debug logs don't seem to offer any help either.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 01:44 PM - edited 09-02-2016 01:47 PM
09-02-2016 01:44 PM - edited 09-02-2016 01:47 PM
Re: REST API -
Have you tried to modify (with the rest-interface session-idle-timeout <SECONDS> command) the rest-interface session-idle-timeout from default 600 seconds to an higher value?
The admitted range spans from 120 seconds up to 7200 seconds.
Are you using the 16.02 REST API and JSON Schema or the 16.01 one?
Both Release Notes look exactly the same but related downloadable files are differents (verified with a diff): I compared the 16.01 (here) with the 16.02 (here) but I can't attach the txt file with the diff between the two device-rest-api folder structures (16.01 vs 16.02)...it appears that 16.02 has more and modified json files.
"The REST API and JSON Schema zip file contains the JSON Schema and REST API documentation for X.16.02.xxxx software. Extract the .zip file locally. The schema folder contains the JSON files. The services folder contains common and wired subfolders, each with an .html document showing the REST resources and referencing the JSON schema employed by each resource."
I'm not an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2017 06:01 AM
06-04-2017 06:01 AM
Re: REST API -
Im a little late to the party but I had lots of issues using the API as well, even in version 16.03.0004. I think theres still some bugs that need to be ironed out. I had luck getting the login to work with curl, but when i tried using powershell I encountered the timeout issue. Strangely, I tried using powershell on OSX (im testing out an alpha version) with exactly the same code and was able to login and perform other requests. What was really interesting was if I used a working session id in (from powershell OSX, curl, postman etc) I was able to perform every other query from powershell without issue. The problem seemed to only be the login request. I ened up using wireshark to have a look at the differences in the packets there was a few differences in headers. Finngers crossed powershell plays nice with the next version, I plan on giving some feedback to HPE/Aruba if theres still issues with the next version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2017 04:26 AM
06-06-2017 04:26 AM
Re: REST API -
Hi Richard5. I have exactly the same issue where I am able to login via cURL command line on my Mac but not in the Chrome Postman App. Frustrating! i've even imported the command line into Postman and it's still saying bad request. I'm also on 16.03. Will post back here if I can sort it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 08:04 AM
06-20-2017 08:04 AM
Re: REST API -
I too have spent too much time getting this to work. The fact the HP has done nothing to fix this or acknoweldge an issue is even worse. I have tried curl on mac and pc, powershell, everything I can think of to get logged in and I get "Bad Request. Please login to access the resource". When I look at the log on the switch in shows a warning "invalid username/password on the REST session; the user " is trying to login." That error leads me to believe a problem exists with passing the username. Frustrating ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 08:26 AM
06-20-2017 08:26 AM
Re: REST API -
Hi Matthew. Mine is working fine from curl on the command line so I don't think it's a total lockout. What version of code are you running on the switch?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 09:20 AM - edited 06-20-2017 09:25 AM
06-20-2017 09:20 AM - edited 06-20-2017 09:25 AM
Re: REST API -
I was on version 16_03_0003 and I couldnt get it to work, so I updated the firmware to 16_03_0004 this morning and still can't get logged in. What version of curl are you using? What does your command line look like? I read a post about quotes not being the same on curl for windows, but the suggestion they gave didnt work either. Any suggestions would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 11:27 AM
06-20-2017 11:27 AM
Re: REST API -
UPDATE I figured it out the issue I was having and wanted to update the post in the event another person has the same issues. After doing some digging in the FAQ for curl I discovered three things that really helped:
3.13 Why does my single/double quotes fail?
Exactly what kind of quotes and how to do this is entirely up to the shell
or command line interpreter that you are using. For most unix shells, you
can more or less pick either single (') or double (") quotes. For
Windows/DOS prompts I believe you're forced to use double (") quotes.
3.22 curl -X gives me HTTP problems
In normal circumstances, -X should hardly ever be used.
By default you use curl without explicitly saying which request method to
use when the URL identifies a HTTP transfer. If you just pass in a URL like
"curl http://example.com" it will use GET. If you use -d or -F curl will use
POST, -I will cause a HEAD and -T will make it a PUT.
4.2 Why do I get problems when I use & or % in the URL?
In Windows, the standard DOS shell treats the percent sign specially and you
need to use TWO percent signs for each single one you want to use in the
URL.
If you want a literal percent sign to be part of the data you pass in a POST
using -d/--data you must encode it as '%25' (which then also needs the
percent sign doubled on Windows machines). In this case the special character was in the password.
So this is what I ended up with:
curl --noproxy <ipaddress> http://<ipaddress>:80/rest/v1/login-sessions -d "{"""userName""":"""username""","""password""":"""password"""}"
Hope others find this helpful.