PowerFlex 3.x "SetPassword" REST API 호출이 "400 Bad Request"를 반환합니다.

Summary: Powershell을 사용하여 VxFlexOS/PowerFlex REST API와 상호 작용하는 동안 "setPassword" 함수는 "400 bad request"를 반환합니다. 그러나 "resetPassword"와 같은 다른 기능은 제대로 작동합니다. 시나리오: 사용자 지정 코드를 사용하여 REST API의 "setPassword" 함수로 로그인한 사용자 암호를 설정하면 VxFlexOS/PowerFlex 게이트웨이가 잘못된 요청 "400" HTML 코드를 반환합니다. 그러나 다른 기능은 여전히 오류 없이 수행됩니다. ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Symptoms

로그 또는 명령줄에서 다음과 유사한 내용으로 "원격 서버에서 오류를 반환했습니다. (400) 잘못된 요청":

image.png

Cause

"setPassword"(oldPassword 객체와 값 및 newPassword 객체와 값이 필요함)와 같이 본문 페이로드가 더 큰 일부 함수의 경우 VxFlex REST API가 사후 호출을 올바르게 해석할 수 있도록 헤더에 컨텐츠 유형 "application/json"도 포함되어야 합니다.

Resolution

이 문제를 해결하려면 웹 요청과 함께 콘텐츠 형식을 제공합니다(예: PowerShell의 아래 코드에서는 게시물이 성공하려면 Invoke-WebRequest 메서드에 "-ContentType "application/json" "을 추가해야 합니다."

#format the user/pw hash in BASE64 to get it parsed by REST
$head = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("admin:Scaleio1234"))}
 
$head
#get token for authorization.
$r = Invoke-WebRequest -Uri https://192.168.199.76/api/login -Method Get -Headers $head -UseBasicParsing
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":" + $r.content.replace('"','')))
$header = @{'Authorization' = "Basic $token"}
$payload2 = @{
oldPassword = 'Scaleio1234'
newPassword = 'Scaleio123'
}
 
$body2 = Convertto-JSON -InputObject $payload2
 
 
 
Invoke-WebRequest -Uri https://192.168.199.76/api/instances/User/action/setPassword -Headers $header -Method Post -ContentType "application/json" -Body $body2

Curl 또는 다른 프로그래밍 언어에서도 동일한 작업을 수행 할 수 있습니다.

curl -v -k -X POST -H "Content-Type:application/json" ...

 

영향을 받는 버전

PowerFlex 3.x

Affected Products

PowerFlex Software

Products

PowerFlex rack, PowerFlex Appliance, PowerFlex custom node
Article Properties
Article Number: 000194607
Article Type: Solution
Last Modified: 14 Apr 2025
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.