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

Unable to create object using REST API

I am making two M-files REST api calls, one to /REST/files, and then I use the returned FileID to call /REST/objects.

My call to first endpoint returns a FileID which increments by 1 every time I call it, so I'm confident that's working.

The call to the objects endpoint returns this error:

The value "104-253878" does not exist, or it is a conflict object.

The second part of the return code is the mandatory metadata field for JobID. In our vault this maps to PropertyDef 1026, and changing this JobID to different numbers has no effect on the error. There are several other Documents in the Vault that have this number as their JobID.

This is what my JSON payload looks like:

{
    "PropertyValues": [
        {
            "PropertyDef": 0,
            "TypedValue": {
                "DataType": 1,
                "Value": "test999.txt"
            }
        },
        {
            "PropertyDef": 22,
            "TypedValue": {
                "DataType": 8,
                "Value": true
            }
        },
        {
            "PropertyDef": 100,
            "TypedValue": {
                "DataType": 9,
                "Lookup": {
                    "Item": 0,
                    "Version": -1
                }
            }
        },
        {
            "PropertyDef": 1026,
            "TypedValue": {
                "DataType": 10,                                
                "Lookups": [
                    {
                        "Item": "253878"
                    }
                ]                                                                        
            }
        },                  
    ],
    "Files": [
        {
            "UploadID": 72,
            "Size": 83,
            "FileInformationType": 0,
            "Title": "test999",
            "Extension": ".txt",
            "TempFilePath": ""
        }
    ]
}

I get the above error if I POST it to the /REST/objects endpoint ( same result in Postman or in code ). 

Has anyone had any luck getting this to work? I am all out of things to try!