phoxelua / matcha

Does money things
0 stars 0 forks source link

create actual restful urls and views #87

Closed phoxelua closed 7 years ago

phoxelua commented 8 years ago

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

jjwon0 commented 8 years ago

http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api

phoxelua commented 7 years ago

pretty much done will refact if needed as we go