We should be acting (VERBS) on resources (NOUNS). For example, GET Users, POST Transactions, etc.
Proposal
Simple, clean cases
Creating a new user: POST - /users
Update a user: PUT - /users/1
Retrieve a user: GET - /users/2
Relationships (better IMO)
This assumes/forces no relations between resources.
Creating a new goal: POST - /goals + JSON body w/ {'user': id, 'category': id ...}
Retrieve a goal: GET - /goals/id
Retrieve goals: GET - /goals?user_id=id&start_date=date
Retrieve transactions: GET - /transactions?user_id=id&goal_id=id..
Relationships (worse IMO)
This forces relations between goals and will force doubling of API urls for M2M relationships
Creating a new goal: POST - /user/id/goals OR /category/id/goals/
Retrieve a goal: GET - /user/id/goals/id OR /goal
Retrieve goals: GET - /user/id/goals?id&start_date=date
Retrieve transactions: GET - /goal/id/transactions AND /transactions/id/goals
Related #67.
We should be acting (VERBS) on resources (NOUNS). For example, GET Users, POST Transactions, etc.
Proposal
Simple, clean cases
Creating a new user: POST - /users Update a user: PUT - /users/1 Retrieve a user: GET - /users/2
Relationships (better IMO)
This assumes/forces no relations between resources.
Creating a new goal: POST - /goals + JSON body w/ {'user': id, 'category': id ...} Retrieve a goal: GET - /goals/id Retrieve goals: GET - /goals?user_id=id&start_date=date
Retrieve transactions: GET - /transactions?user_id=id&goal_id=id..
Relationships (worse IMO)
This forces relations between goals and will force doubling of API urls for M2M relationships
Creating a new goal: POST - /user/id/goals OR /category/id/goals/ Retrieve a goal: GET - /user/id/goals/id OR /goal Retrieve goals: GET - /user/id/goals?id&start_date=date
Retrieve transactions: GET - /goal/id/transactions AND /transactions/id/goals