This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

REST API - PUT Call

Hello guys

We face a problem with the REST API POST Call which should update an object. Unfortunately, the response body shows "malformed data". However, the Request Header and Body are as in the Postman Collection and the selected property 1194 is 100% a text property (DataType = 1). The object is checked out correctly first through the API call, but then something goes wrong in the subsequent POST/PUT request.

Anyone could give me a hint?

Other operations like creating an object or GET requests are not a problem and work well.

Response body:

{
    "Status": 400,
    "URL": "/objects/0/305/latest/properties/1194",
    "Method": "POST",
    "Exception": {
        "Name": "ArgumentException",
        "Message": "Malformed data."
    },
    "Stack": "Error reference ID: dc3c78e6-5d15-40b3-a690-e7ecbb3231d9",
    "Message": "Malformed data.",
    "IsLoggedToVault": true,
    "IsLoggedToApplication": true,
    "ExceptionName": "ArgumentException"
}

Request Header URL:

https://{{MF_URL}}/REST/objects/0/305/latest/properties/1194?_method=PUT

Request body:

[
{
"PropertyDef": 1194,
"TypedValue": {
"DataType": 1,
"Value": "QRR"
}
}
]

Kind regards

Dario

Parents Reply Children
  • Hi Craig

    Thank you very much for your hint, it works now :-).

    I used /properties as endpoint though and included the array [] in the body. In the postman collection it is unfortunately not very clear, since the call "Set all properties" includes the property ID in the URL and various properties in the body, while the Set property call does not include the property in the URL but still includes the [] in the body, although there is only 1 property to be updated.

    Is there maybe somewhere a more recent postman collection?

    Kind regards,

    Dario

  • It looks like there's a bug in that version.  It looks like the latest version doesn't include a sample using that endpoint: MFilesSamplesAndLibraries/Libraries/Postman at master · M-Files/MFilesSamplesAndLibraries (github.com)

    Edit: it looks like the "set all properties" sample - the one you're using - should not have had that property in the URI, so it was removed a couple of months ago.  There doesn't appear to be a "set single property" sample at the moment, but the guidance that I gave above should allow you to use it.