Add new file in existing object using REST API

I have an object with some files.
Now I need to remove all files and add new file in that object.
 I can remove files using below Service

"http://localhost/REST/objects/{checkedOutObjectVersion.ObjVer.Type}/{checkedOutObjectVersion.ObjVer.ID}/{checkedOutObjectVersion.ObjVer.Version}/files/{checkedOutObjectVersion.Files[0].ID}.aspx?_method=DELETE"

Now I would like to add new file in that Object.

Upload new file in temp location.

{{url}}/REST/files

Now trying to update in document using below service


{{url}}REST/objects/
{checkedOutObjectVersion.ObjVer.Type}/{checkedOutObjectVersion.ObjVer.ID}/{checkedOutObjectVersion.ObjVer.Version}/files

But getting below response


What is the wrong I am doing

Parents Reply
  • I just checking the code base, here 1st upload the local file to temp location in M-Files,

    Then pass that uploadInfo variable in API
    "/REST/objects/{objectType}/{objectId}/{versionString}/files/upload

    in updateInfo variable
    below data is stored

    =================================

    So in my postman call, Same URL, Same Title, Extension & Size to get the uploadInfo


    Then using that info to File Upload as like as line 507 in the code base you shared.


    What is the wrong I am doing?

Children