Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 1.48 KB

API.md

File metadata and controls

83 lines (59 loc) · 1.48 KB

reddit-newsletter/API

The following API usage examples assume httpie but curl or wget works just as well

Healthcheck

http GET 'http://localhost:4000/ping'

Users

List all users

http GET 'http://localhost:4000/api/users'

Get user by id

http GET 'http://localhost:4000/api/users/1'

Deleting a user by id

http DELETE 'http://localhost:4000/api/users/1'

Create new user

http --json POST 'http://localhost:4000/api/users' \
'Content-Type':'application/json; charset=utf-8' \
email="maria@service.com" \
fullname="maria" \
time_preference="7"

Patch user

http --json PATCH 'http://localhost:4000/api/users/1' \
'Content-Type':'application/json; charset=utf-8' \
email="email@service.com" \
active="true" \
time_preference="1" \
fullname="foobar"

Subscriptions

List all subscriptions

http GET 'http://localhost:4000/api/subscriptions'

Upsert subscription

http --json POST 'http://localhost:4000/api/users/1/subs' \
'Content-Type':'application/json; charset=utf-8' \
url="https://www.reddit.com/r/worldnews/" \
subreddit="worldnews"

Subredits

List all subreddits

http GET 'http://localhost:4000/api/subreddits'

Patch a subreddits's top posts

http --json PATCH 'http://localhost:4000/api/subreddits/1/tops' \
'Content-Type':'application/json; charset=utf-8' \
tops="[{}, {}, {}]"