The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

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

Update Object Property Value Through API

Hi everyone,

I’ve a business case where I need to update document workflow state from other system (typically purchasing system developed using Oracle) through REST APIs, the reference between the M-Files and the purchasing system is the Hyperlink of the M-Files document which been saved manually in the purchasing system by the user who attach the document in the M-Files.
The problem is: in some cases the hyperlink contains the Object ID (numeric) which is displayed on the top of the metadata card and some cases it contains a GUID “02417C93-677F-41CF-AC15-14CDAEE72AB6”, after searching I’ve found this

https://developer.m-files.com/APIs/REST-API/Reference/syntax/


Accordingly I create a function to normalize the Uri:

string NormalizeUri(string objectId)
{
    if (objectId.Length >= 32)
        return $"/REST/objects/0/u{objectId}%3ADocument%252101/latest";
    else
        return $"/REST/objects/0/{objectId}/latest";
}

But when I call the API I get the error “The remote server returned an error: (404) Not Found”, I’ve also tried to remove the “-“ from the GUID but no luck, however it works fine when I use the numeric object ID shown on top of metadata card.

Appreciate your support as always.

Looking forward,

Parents Reply Children
  • Yes you are right, these Hyperlinks are for Classic Web, below is sample from Get Hyperlink menu:

    Desktop: m-files://show/FA98CF7B-7EB8-40E7-B271-CC4D0E313F56/0-95594/217697?object=3CF8F29D-A596-4DCC-959B-0FCE8C03B3BC&file=95053B26-7142-4BAA-83B9-0149A19E2793

    Web: my-server/link.ashx

    Mobile: m-files://show/FA98CF7B-7EB8-40E7-B271-CC4D0E313F56/0-95594/217697?object=3CF8F29D-A596-4DCC-959B-0FCE8C03B3BC&file=95053B26-7142-4BAA-83B9-0149A19E2793

    I ended up searching for the Objects in M-Files using Invoice No. which is also shared reference between both, its a little lengthy process to call search APIs just to get the Object ID, then Check out the object, then Update the property value and finally Check in the object back again; but sounds like this is the only available option.

    Regards,