- Community Home
- >
- Servers and Operating Systems
- >
- HPE ProLiant
- >
- Server Management - Remote Server Management
- >
- REST API iLO5 - CURL POST always returns 'BAD REQU...
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
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
08-08-2019 11:50 PM
08-08-2019 11:50 PM
Hi!
Could anyone show how to use curl to 'post' data via REST API to iLO5? Below is an example, I am able to get SNMP related data but when trying to modify it via POST it always returns BAD REQUEST.
Thanks!
1) .\curl.exe https://IP/redfish/v1/Managers/1/SnmpService/ -s -i --insecure -u user:pswd
HTTP/1.1 200 OK
Allow: GET, HEAD, POST, PATCH
Cache-Control: no-cache
Content-type: application/json; charset=utf-8
Date: Fri, 09 Aug 2019 06:40:36 GMT
ETag: W/"82DEEBBA"
Link: </redfish/v1/SchemaStore/en/HpeiLOSnmpService.json/>; rel=describedby
OData-Version: 4.0
Transfer-Encoding: chunked
X-Frame-Options: sameorigin
X_HP-CHRP-Service-Version: 1.0.3
2) .\curl.exe -s -i --insecure -X POST -H "Content-Type: application/json" -d '{"Location":"Test"}' -u user:pswd https://IP/redfish/v1/Managers/1/SnmpService/
HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-type: application/json; charset=utf-8
Date: Fri, 09 Aug 2019 06:41:55 GMT
ETag: W/"02C2D1BB"
OData-Version: 4.0
Transfer-Encoding: chunked
X-Frame-Options: sameorigin
X_HP-CHRP-Service-Version: 1.0.3
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2019 07:10 PM
08-11-2019 07:10 PM
Re: REST API iLO5 - CURL POST always returns 'BAD REQUEST'
Hello
I would suggest you to go through the below link.
https://hewlettpackard.github.io/ilo-rest-api-docs/ilo5/
Thanks
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2019 07:40 PM - edited 08-13-2019 07:40 PM
08-13-2019 07:40 PM - edited 08-13-2019 07:40 PM
SolutionTry to do a PATCH instead of a POST.
If you get a MalformedJSON error. Check if you need to add "\" in front of double quote.
More explain on adding slash in front of double quotes
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 12:50 AM - edited 08-14-2019 12:51 AM
08-14-2019 12:50 AM - edited 08-14-2019 12:51 AM
Re: REST API iLO5 - CURL POST always returns 'BAD REQUEST'
Thanks a lot! That was exactly what was needed.
The working syntax below:
.\curl.exe -i --insecure -X PATCH -H "Content-Type: application/json" -d "{\"Location\":\"New location\"}" -u user:pswd -L https://{IP}/redfish/v1/Managers/1/SnmpService/
Milan