luddinus
396
2
Tips

Naming Api endpoints when two "Entities" are envolved.

Posted 1 year ago by luddinus

Hi,

I pick "tips" channel but I'm don't know if it is the correct. Anyway:

I have users and offers, and users can apply to job offers.

How would you name the api?

POST api/users/{user_id}/offers/{offer_id}/apply
POST api/offers/{offer_id}/apply/{user_id}
...
POST api/offers/{offer_id}/apply // pass the user_id in request body { user_id: 1 }

I'm using the first one but it seems a little awkard to me.

Thx!

Please sign in or create an account to participate in this conversation.