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,