Question

I'm developing a game website where accounts have characters. I'm using the routes:

account/{action} //execute `action` on the current account
character/{name}/{action} //execute `action` on specific character

But I need to delete and undelete (they are soft-deleted) characters, and while using a form is the right way for delete, it becomes unnecessary (is it?) bloat when I can use just a GET link to character/{name}/delete. Also, there is no verb for undeleting/restoring.

What is the correct and easy way (or both if there isn't the perfect way) to workaround this?

No correct solution

OTHER TIPS

You could have a RESTful version if your URLs have nouns instead of verbs, such as :

character/{name}/achievements or

character/{name}/travels

To solve your active/inactive account problem, you could do :

GET/PUT account/activity

Already not restful, in which you are determining the action based on the route, not based on the verb. So that said, make a new route that is undelete (i.e. character/{name}/undelete), your already not REST so another route shouldn't matter. If you are looking for RESTful then the route should stay account/{character} and the verb determines the action(i.e. GET,PUT, POST DELETE to the same route). Now since you are not actually deleting, I would learn towards a POST (or perhaps PUT) for both i.e. updaing the entity to delete (or inactive), or updating it to undelete (active again)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top