reapit / foundations

Foundations platform mono repo
57 stars 21 forks source link

Is patch Metadata API error? #8335

Closed abrahamseni closed 1 year ago

abrahamseni commented 1 year ago

Summary Is the Metadata API patch have an error? It was working fine yesterday.

Detail and or supporting links and screenshots This is the curl payload:

curl 'https://platform.reapit.cloud/tenancies/MKT230008/checks/RPT23000918' \
  -X 'PATCH' \
  -H 'authority: platform.reapit.cloud' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9,id;q=0.8' \
  -H 'api-version: 2020-01-31' \
  -H 'authorization: Bearer 123456' \
  -H 'cache-control: max-age=0' \
  -H 'content-type: application/json' \
  -H 'if-match: "E7B1FE099B90557E81EDB53B8FF0AF77"' \
  -H 'origin: https://responsible-building.iaas.paas.reapit.cloud' \
  -H 'referer: https://responsible-building.iaas.paas.reapit.cloud/' \
  -H 'sec-ch-ua: "Chromium";v="104", " Not A;Brand";v="99", "Microsoft Edge";v="104"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Linux"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: same-site' \
  -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36 Edg/104.0.1293.54' \
  --data-raw '{"status":"needed","metadata":{"lettings":{"modifiedByUser_email":"","modifiedByUser_name":"","hasChangedByUser":false,"reasonForRejection":""}}}' \
  --compressed

That will result in 422 error:

{
  "errors": [
    {
      "field": "Metadata",
      "message": "The value provided contains characters or terms which are not permitted"
    }
  ],
  "statusCode": 422,
  "dateTime": "2023-01-17T06:19:28.2954263Z",
  "description": "One or more validation failures have occurred. Please refer to Errors list for details"
}
AshDeeming commented 1 year ago

Hi @abrahamseni Please can you confirm which field/value you are attempting to patch?

abrahamseni commented 1 year ago

Hi @AshDeeming This is the field/value I try to patch:

"metadata":{
  "lettings":{
    "modifiedByUser_email":"",
    "modifiedByUser_name":"",
    "hasChangedByUser":false,
    "reasonForRejection":""
  }
}

Is it because of the "" empty string? because it worked fine before.

plittlewood-rpt commented 1 year ago

Likely related to #7938