Social Medial Activity Feed
Endpoint | Method | Request | Response | Note |
---|---|---|---|---|
/register | POST | { actor: "irvan", | 201 Created | register new actor |
friends: [] } | ||||
/follow/{actor}/ | POST | { actor: "niko" } | 204 No Content | follow friend |
/follow/{actor}/{friend} | DELETE | 204 No Content | unfollow friend | |
/feeds | POST | {actor: ..., verb: ..., object: ..., target: ...} | 200 OK | New activity feed |
/feeds/{actor}/ | GET | 200 OK | get activity feed |
-
Edit configuration in
.env
-
run
docker-compose up
inside project directory to compile, run API mongo and mongo service. -
Access API server using web client to address
http://localhost:8080
orMEDSOS_ADDRESS
from.env
-
Register new actor
curl -v X POST http://localhost:8080/register -H "Content-Type: application/json" -d '{"actor":"irvan","friends":[]}'
-
Post new feed
curl -v -X POST http://localhost:8080/feeds -H "Content-type: application/json" -d '{"actor":"irvan","verb":"post","object":"post:1"}'
-
Get feeds
curl -v -X GET http://localhost:8080/feeds/irvan/
-
Follow friend
curl -v -X POST http://localhost:8080/follow/irvan/ -H "Content-type: application/json" -d '{"actor":"niko"}'
-
Unfollow friend
curl -v -X DELETE http://localhost:8080/follow/irvan/niko