{"endpoints":{"GET /api":{"example url":"/api","description":"serves a JSON file showing all available API endpoints"},"GET /api/loyalty_cards":{"description":"serves an array of all loyalty cards","queries":["user_id","sort_by","order","merchant_id","id (loyalty_cards.id)"],"example url":"/api/loyalty_cards","example url query":"/api/loyalty_cards?user_id=U2&merchant_id=B&&id=2&sort_by=points&order=desc","example response (with no query)":{"loyalty_cards":[{"id":1,"loyalty_program_id":1,"user_id":"U1","points":0,"created_at":"2024-01-04T15:43:47.508Z","merchant_id":"A","name":"programShopA","required_points":6}]}},"GET /api/loyalty_cards/:loyalty_card_id":{"description":"serves an object containing the loyalty card with that specific id","example url":"/api/loyalty_cards/1","example response":{"loyalty_card":{"id":1,"loyalty_program_id":1,"user_id":"U1","points":0,"created_at":"2024-01-04T15:43:47.508Z","merchant_id":"A","name":"programShopA","required_points":6}}},"PATCH /api/loyalty_cards/:loyalty_card_id":{"description":"allows loyalty_cards points to be updated","example patch":{"inc_points":4}},"GET /api/merchants":{"description":"serves an array of all merchants","example url":"/api/merchants","example response":{"merchants":[{"id":"A","user_id":"M1","company_name":"shopA","description":"This is the shop A","address":"A Street","phone_no":"0711111111","logo_url":"https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700","category":"coffee"}]}},"GET /api/merchants/:id":{"description":"serves an object showing one specific merchant","example url":"/api/merchants/M1","example response":{"merchant":{"id":"B","user_id":"M2","company_name":"shopB","description":"This is the shop B","address":"B Street","phone_no":"0722222222","logo_url":"https://images.pexels.com/photos/158651/news-newsletter-newspaper-information-158651.jpeg?w=700&h=700","category":"bakery"}}},"PATCH /api/merchants/:id":{"description":"allows information for a specific merchant to be changed","example patch":{"phone_no":2343323,"address":"A Street"}},"GET /api/merchants/:id/cards":{"description":"serves an array showing loyalty_cards for this specific merchant","example url":"/api/merchants/M1/cards","example response":{"loyalty_cards":[{"id":1,"loyalty_program_id":1,"user_id":"U1","points":0,"created_at":"2024-01-04T15:43:47.508Z","merchant_id":"A","name":"programShopA","required_points":6}]}},"GET /api/merchants/:id/programs":{"description":"serves an object showing loyalty_cards for this specific merchant","example url":"/api/merchants/M1/programs","example response":{"loyalty_programs":{"id":1,"merchant_id":"A","name":"programShopA","required_points":6,"created_at":"2024-01-04T15:43:47.508Z"}}},"POST /api/merchants/:id/programs":{"description":"returns an object showing a newly created loyalty program for this specific merchant","example url":"/api/merchants/M1/programs","example post":{"name":"this is a new program","required_points":400},"example response":{"loyalty_programs":{"id":5,"merchant_id":"A","name":"this is a new program","required_points":400,"created_at":"2024-01-08T14:56:00.318Z"}}},"GET /api/merchants/:id/programs/:program_id":{"description":"returns an object showing a newly created loyalty program for this specific merchant","example url":"/api/merchants/M1/programs/1","example response":{"loyalty_programs":{"id":1,"merchant_id":"A","name":"this is a new program","required_points":400,"created_at":"2024-01-08T14:56:00.318Z"}}},"DELETE /api/merchants/:id/programs/:program_id":{"description":"returns an object showing a newly created loyalty program for this specific merchant","example url":"/api/merchants/M1/programs/1","example response":{}},"DELETE /api/redeem/:user_id/:loyalty_card_id":{"description":"allows a loyalty card to be deleted for a specific user"},"PATCH /api/redeem/:user_id/:loyalty_card_id":{"description":"PATCH requests should be made with no body. When a patch request is made to this endpoint, if points & required_points are the same value: points will be reset to 0.","example response":"Points Reset"},"GET /api/users/:user_id":{"description":"shows an object showing a specific user","example url":"/api/users/U2","example response":{"user":{"id":"U2","name":"sam"}}},"DELETE /api/users/:user_id":{"description":"allows a specific user to be deleted"},"GET /api/users/:user_id/loyalty_cards/":{"description":"serves an array of loyalty cards for the given user","example url":"/api/users/U2/loyalty_cards","example response":[{"id":4,"loyalty_program_id":3,"user_id":"U2","points":6,"created_at":"2024-01-09T16:45:16.883Z","required_points":10,"name":"Coffee Card","company_name":"Idle Hands Coffee"}]},"POST /api/users/:user_id/loyalty_cards/:loyalty_program_id":{"description":"allows a new card to be created for a user","example url":"/api/users/U2/loyalty_cards/1","example response":{"id":2,"loyalty_program_id":1,"user_id":"U2","points":1,"created_at":"2024-01-04T15:43:47.508Z","merchant_id":"B","name":"programShopB","required_points":5}},"GET /api/loyalty_programs/":{"description":"serves an object containing the loyalty programs with that specific id","example url":"/api/loyalty_programs","example response":{"loyalty_programs":{"id":1,"merchant_id":"A","name":"programShopA","required_points":6,"created_at":"2024-01-02T16:01:13.985Z"}}},"GET /api/loyalty_programs/:merchant_id":{"description":"serves an object containing the loyalty programs with that specific id","example url":"/api/loyalty_programs/M1","example response":{"loyalty_programs":{"id":1,"merchant_id":"M1","name":"programShopA","required_points":6,"created_at":"2024-01-02T16:01:13.985Z"}}}}}