REST API call returns error code PASWS168E when the value includes double quote
Symptom
User tried to use REST API to update a field with data type String.
When REST API call body includes double quote marks, web service will return error code PASWS168E.
For example
If user put a call header: Patch https://{{PVWAURL}}/PasswordVault/api/Accounts/{{AccountID}}
with below REST API call body
[
{
"op": "replace",
"path": "/secretmanagement/manualmanagementreason",
"value": "test "quoted text" "
}
]
It will return below error
{
"Details": [
{
"ParameterName": "value",
"ErrorCode": "PASWS168E",
"ErrorMessage": "Input parameter for [value] value is invalid"
}
],
"ErrorCode": "PASWS167E",
"ErrorMessage": "There are some invalid parameters"
}
Environment
10.0;10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;10.9;10.10;11.1;11;11.2;11.3;11.4;11.5;11.6;11.7 Privileged Access Manager (PAM, self-hosted) Password Vault Web Access PVWA 10.8, Windows 2012R2
Cause
There is a restriction in JSON. Some offending characters could prevent parsing.
Resolution
The following characters are reserved in JSON and must be escaped to be used in Rest API call
Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Tab is replaced with \t
Double quote is replaced with \"
Backslash is replaced with \\
Therefore , to be able to properly insert the double quote mark in above example REST API call , please update the body to
[
{
"op": "replace",
"path": "/secretmanagement/manualmanagementreason",
"value": "test \"quoted text\" "
}
]
Additional Information
Details
SYMPTOM:
User tried use REST API to update a field with data type String. The value included double quote mark.
Error code PASWS168E was returned from webservice
For example
call header: Patch https://{{PVWAURL}}/PasswordVault/api/Accounts/{{AccountID}}
It works with call body
[
{
"op": "replace",
"path": "/secretmanagement/manualmanagementreason",
"value": "test "
}
]
However, when I changed the body to
[
{
"op": "replace",
"path": "/secretmanagement/manualmanagementreason",
"value": "test "quoted text" "
}
]
{
"Details": [
{
"ParameterName": "value",
"ErrorCode": "PASWS168E",
"ErrorMessage": "Input parameter for [value] value is invalid"
}
],
"ErrorCode": "PASWS167E",
"ErrorMessage": "There are some invalid parameters"
}
PROBLEM:
There is a restriction in JSON. Some offending characters could prevent parsing.
SOLUTION
The following characters are reserved in JSON and must be escaped to be used in Rest API call
Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Tab is replaced with \t
Double quote is replaced with \"
Backslash is replaced with \\
Therefore , to be able to properly insert the double quote mark in above example REST API call , please update the body to
[
{
"op": "replace",
"path": "/secretmanagement/manualmanagementreason",
"value": "test \"quoted text\" "
}
]