Domanda

I want to edit multiple resources over REST. For example I have folders and files.

Now I move three files from folder A to folder B. For edit the parentId of the file I use the PATCH action.

When I want to keep the controller RESTful do i need to send for each moved file a request to my REST controller?

È stato utile?

Soluzione

I think you should add a transaction resource.

POST /transactions
{
    type: "move",
    files: [...],
    destinies: [...],
}

202 - accepted
{
    progress: 0.23,
    _links: {
        self: {href: "/transactions/123"}
    }
}

It could be just temporary, or you could use the collection as an event log. By getting the representation of it with comet or websocket could contain the progress...

I don't think there are any other options, only moving the files one by one, or patching the directory of the files if they contain a property like that...

Altri suggerimenti

If your API supports moving a file by doing a PATCH on the file, then yes, you'd send a different request for each file to be moved.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top