<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic REST API iLO5 - CURL POST always returns 'BAD REQUEST' in Server Management - Remote Server Management</title>
    <link>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058131#M8465</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1) .\curl.exe https://IP/redfish/v1/Managers/1/SnmpService/ -s -i --insecure -u user:pswd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTTP/1.1 200 OK&lt;/STRONG&gt;&lt;BR /&gt;Allow: GET, HEAD, POST, PATCH&lt;BR /&gt;Cache-Control: no-cache&lt;BR /&gt;Content-type: application/json; charset=utf-8&lt;BR /&gt;Date: Fri, 09 Aug 2019 06:40:36 GMT&lt;BR /&gt;ETag: W/"82DEEBBA"&lt;BR /&gt;Link: &amp;lt;/redfish/v1/SchemaStore/en/HpeiLOSnmpService.json/&amp;gt;; rel=describedby&lt;BR /&gt;OData-Version: 4.0&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;X-Frame-Options: sameorigin&lt;BR /&gt;X_HP-CHRP-Service-Version: 1.0.3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;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/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTTP/1.1 400 Bad Request&lt;/STRONG&gt;&lt;BR /&gt;Cache-Control: no-cache&lt;BR /&gt;Content-type: application/json; charset=utf-8&lt;BR /&gt;Date: Fri, 09 Aug 2019 06:41:55 GMT&lt;BR /&gt;ETag: W/"02C2D1BB"&lt;BR /&gt;OData-Version: 4.0&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;X-Frame-Options: sameorigin&lt;BR /&gt;X_HP-CHRP-Service-Version: 1.0.3&lt;/P&gt;</description>
    <pubDate>Fri, 09 Aug 2019 06:50:49 GMT</pubDate>
    <dc:creator>MFajt</dc:creator>
    <dc:date>2019-08-09T06:50:49Z</dc:date>
    <item>
      <title>REST API iLO5 - CURL POST always returns 'BAD REQUEST'</title>
      <link>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058131#M8465</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1) .\curl.exe https://IP/redfish/v1/Managers/1/SnmpService/ -s -i --insecure -u user:pswd&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTTP/1.1 200 OK&lt;/STRONG&gt;&lt;BR /&gt;Allow: GET, HEAD, POST, PATCH&lt;BR /&gt;Cache-Control: no-cache&lt;BR /&gt;Content-type: application/json; charset=utf-8&lt;BR /&gt;Date: Fri, 09 Aug 2019 06:40:36 GMT&lt;BR /&gt;ETag: W/"82DEEBBA"&lt;BR /&gt;Link: &amp;lt;/redfish/v1/SchemaStore/en/HpeiLOSnmpService.json/&amp;gt;; rel=describedby&lt;BR /&gt;OData-Version: 4.0&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;X-Frame-Options: sameorigin&lt;BR /&gt;X_HP-CHRP-Service-Version: 1.0.3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;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/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTTP/1.1 400 Bad Request&lt;/STRONG&gt;&lt;BR /&gt;Cache-Control: no-cache&lt;BR /&gt;Content-type: application/json; charset=utf-8&lt;BR /&gt;Date: Fri, 09 Aug 2019 06:41:55 GMT&lt;BR /&gt;ETag: W/"02C2D1BB"&lt;BR /&gt;OData-Version: 4.0&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;X-Frame-Options: sameorigin&lt;BR /&gt;X_HP-CHRP-Service-Version: 1.0.3&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 06:50:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058131#M8465</guid>
      <dc:creator>MFajt</dc:creator>
      <dc:date>2019-08-09T06:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: REST API iLO5 - CURL POST always returns 'BAD REQUEST'</title>
      <link>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058334#M8466</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest you to go through the below link.&lt;/P&gt;&lt;P&gt;&lt;A href="https://hewlettpackard.github.io/ilo-rest-api-docs/ilo5/" target="_blank"&gt;https://hewlettpackard.github.io/ilo-rest-api-docs/ilo5/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 02:10:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058334#M8466</guid>
      <dc:creator>Suvamay</dc:creator>
      <dc:date>2019-08-12T02:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST API iLO5 - CURL POST always returns 'BAD REQUEST'</title>
      <link>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058588#M8468</link>
      <description>&lt;P&gt;Try to do a PATCH instead of a POST.&lt;/P&gt;&lt;P&gt;If you get a MalformedJSON error. Check if you need to add "\" in front of double quote.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.oracle.com/cd/E27559_01/dev.1112/e27134/appendixcurl.htm#AIDEV6413" target="_blank" rel="noopener"&gt;More explain on adding slash in front of double quotes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 02:40:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058588#M8468</guid>
      <dc:creator>chrislee18a</dc:creator>
      <dc:date>2019-08-14T02:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: REST API iLO5 - CURL POST always returns 'BAD REQUEST'</title>
      <link>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058635#M8469</link>
      <description>&lt;P&gt;Thanks a lot! That was exactly what was needed.&lt;/P&gt;&lt;P&gt;The working syntax below:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.\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/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Milan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 07:51:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/server-management-remote-server/rest-api-ilo5-curl-post-always-returns-bad-request/m-p/7058635#M8469</guid>
      <dc:creator>MFajt</dc:creator>
      <dc:date>2019-08-14T07:51:40Z</dc:date>
    </item>
  </channel>
</rss>

