ODataUtils
ODataUtils copied to clipboard
Set commandlet does not have the PATCH request body
When we use a Set commadlet and pass the values to the settable attributes, the same is not sent as part of the PATCH request body.
When the Set Cmdlets pass the attribute values the same is not sent as part of the HTTP PATCH request body
For example, when we try to set Accountlockout Duration for account service, we get an error.
_$sr = Get-ServiceRoot -Credential $cred
$accountservice = Get-AccountService -ServiceRoot $sr -Credential $cred_
_PS C:> Set-AccountService -OdataId $accountservice.'@odata.id' -AccountLockoutDuration 2000 -Credential $cred Exception calling "ProcessRecord" with "1" argument(s): "The remote server returned an error: (400) Bad Request." At line:251 char:7
-
$__cmdletization_objectModelWrapper.ProcessRecord($__cmdletizat ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : CmdletInvocationException_
When we look through the request sent by auto-generated module, we find there is no json body to the request (See attached file Set-accountservice.txt). Similarly every Set Cmdlet fails with Bad request Message from the Redfish Server (iDRAC).
Fiddler Output: PATCH https://100.98.8.22/redfish/v1/Managers/iDRAC.Embedded.1/AccountService HTTP/1.1 Accept: application/json OData-Version: 4.0 User-Agent: Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.14393.953 Content-Type: application/json;charset=utf-8 Authorization: Basic cm9vdDpjYWx2aW4= Host: 100.98.8.22 Content-Length: 0
HTTP/1.1 400 Bad Request Keep-Alive: timeout=60, max=199 Content-Type: application/json; charset=utf-8 Server: Appweb/4.5.4 Date: Wed, 26 Apr 2017 03:15:38 GMT Cache-Control: no-cache Connection: Keep-Alive Accept-Ranges: bytes Content-Length: 0