<?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 Re: Power off server in HPE OneView</title>
    <link>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173500#M7503</link>
    <description>&lt;P&gt;Just trying to mark as solved.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 11:01:29 GMT</pubDate>
    <dc:creator>BradV</dc:creator>
    <dc:date>2022-09-07T11:01:29Z</dc:date>
    <item>
      <title>Power off server</title>
      <link>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173452#M7501</link>
      <description>&lt;P&gt;I'm trying to send a REST API call to a server to power it off, but getting back:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"errorCode":"INVALID_JSON_DATA_TYPE","message":"Invalid JSON data type.","details":"The JSON sent in the request contained a unknown type where a different unknown type is required on line 1 near column 15.","messageParameters":[],"recommendedActions":["Correct the content of the JSON and retry the request."],"errorSource":null,"nestedErrors":[],"data":{}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just realized why I was getting that.&amp;nbsp; I was using "off" instead of "Off."&amp;nbsp; So, case is significant.&amp;nbsp; Might be good to point out in the API reference what the exact allowed values are for powerState?&lt;/P&gt;&lt;P&gt;My working code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SERVER=my.fqdn
POWER=&amp;lt;On|Off&amp;gt;
ACTV=$(python -c "import urllib, sys; print urllib.quote(sys.argv[1])" "\"serverName = '${SERVER}'\"")
UUID=$(curl --insecure --silent \
      --header "auth: ${sessionID}" \
      --header "X-API-Version: ${currentVersion}" \
      --request GET ${OneView}/rest/server-hardware?filter=${ACTV} | jq -r '.members[] | .uuid')
DATA='{"powerState":"'${POWER}'","powerControl":"MomentaryPress"}'
TASKURI=$(curl --insecure \
       --header "content-type: application/json" \
       --header "X-API-Version: ${currentVersion}" \
       --header "auth: ${sessionID}" \
       --include \
       --data "${DATA}" \
       --request PUT ${OneView}/rest/server-hardware/${UUID}/powerState |  grep '^Location:' | awk '{ print $2})
echo "Can check the power off task at: ${TASKURI}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 12:02:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173452#M7501</guid>
      <dc:creator>BradV</dc:creator>
      <dc:date>2022-09-07T12:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Power off server</title>
      <link>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173500#M7503</link>
      <description>&lt;P&gt;Just trying to mark as solved.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 11:01:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173500#M7503</guid>
      <dc:creator>BradV</dc:creator>
      <dc:date>2022-09-07T11:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Power off server</title>
      <link>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173511#M7504</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/1179670"&gt;@BradV&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for sharing the info. We hope it'll help other community members.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 12:39:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-oneview/power-off-server/m-p/7173511#M7504</guid>
      <dc:creator>Sunitha_Mod</dc:creator>
      <dc:date>2022-09-07T12:39:22Z</dc:date>
    </item>
  </channel>
</rss>

