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,

  • The syntax you're using is for unmanaged objects in external repositories (M-Files Web Service: Object version).  I doubt that's what you have.

    Can you post an example of the hyperlink that includes the GUID, please?

    Regards,

    Craig.

  • Thanks Carig for the swift response. below are samples for hyperlinks, the first with numeric ID and the second with GUID ID.

    Display ID: 95594

    http://my-server/Default.aspx#FA98CF7B-7EB8-40E7-B271-CC4D0E313F56/mfd/0/95594/latest

    GUID ID:


    http://my-server/Default.aspx?#FA98CF7B-7EB8-40E7-B271-CC4D0E313F56/object/A76532D1-D6D8-464C-A355-C5D908164DDE/latest

    Looking forward,

  • Oh, so these aren't M-Files links, but they're links to... I guess the Classic Web instance.

    I can't see any documented REST API endpoints that allow object GUID -> object ID lookup.  There's a COM API method, but not REST.  I assume REST is mandatory?

  • 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,