curl http://localhost:3000/users?facebook_id=<facebook_id> --header "Accept: application/json"
Code: HTTP 200
Code: 404 No body.
To create a fresh user pass in the facebook_id, the facebook avatar link and a boolean flag whether or not this user is to be created as registered.
curl -X POST http://localhost:3000/users --header "Content-Type: application/json" --header "Accept: application/json" -d '{"facebook_id": "123", "facebook_avatar":"foo", "registered":"false"}'
Code: 201 Created
{"id":2,"facebook_id":"123","facebook_avatar":"foo","registered":null,"created_at":"2015-06-13T07:55:57.039Z","updated_at":"2015-06-13T07:55:57.039Z"}
-- NOTE: We set a friend as registered when we add friends.
- In order to add a friend to user you first must check to see if the user exists. See CREATE A USER
- If the user does not exists create it. See CREATE A USER
Take note of the friend's id (not facebook id).
- To add the friend:
curl -X POST http://localhost:3000/users/<user_id>/friends/<friend_id> --header "Accept: application/json" -d ''
[{"id":2,"facebook_id":"123","facebook_avatar":"foo","registered":null,"created_at":"2015-06-13T07:55:57.039Z","updated_at":"2015-06-13T07:55:57.039Z"},{"id":2,"facebook_id":"123","facebook_avatar":"foo","registered":null,"created_at":"2015-06-13T07:55:57.039Z","updated_at":"2015-06-13T07:55:57.039Z"}]```
### CREATE A RATING