I have interesting situation here, which I’d like to draw your opinions upon. I’m designing a REST API and here are the Resources pertaining to this question.
-
I have an User Entity, which I create through POST
/users/
and Read-Update-Delete(RUD) by/users/:user-id
-
I have an Event Entity which I create through POST
/events/
and Read-Update-Delete(RUD) by/events/:event-id
-
Now, multiple Users can be associated to multiple Events. This is why, there is a Member Entity which references a
user-id
andevent-id
. Basically, every time a User attends an Event, he as a unique Member profile for that Event. Member is created through/events/:event-id/members
and modified through/events/:event-id/members/:member-id
-
I have Mini Events which are parts of Events. A Mini Event is NOT an Event, but instead a part of an Event. They are created through
/events/:event-id/minievent
and modified through/events/:event-id/minievent/:minievent-id
Here’s my question
I wish to associate Members of an Event to a Mini Event of naturally, the same Hackathon.
The first way that comes to mind is POST event/event:id/minievents/:minievents/members
BUT the Member entity I wish to associate to this Mini Event has been created when I created this Member for this Event. Naturally, you cannot associate a Member to a Mini-Event before creating a Member for the main Event in the first place.
I believe using POST event/event:id/minievents/:minievents/members
would be incorrect as it would mean creating members but they have already been created.
I wish to associate Members of an Event to a Mini Event. What would be the most RESTful way to do this?
Note: Mini Events have a different schema than Events, they are different entities and not interchangeable. Don’t suggest making Mini Events and Events the same thing.