Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

api #108

Open
recoilme opened this issue Oct 9, 2018 · 4 comments
Open

api #108

recoilme opened this issue Oct 9, 2018 · 4 comments

Comments

@recoilme
Copy link
Owner

recoilme commented Oct 9, 2018

Get last 20 articles
curl --header "Content-type:application/json" 'http://sub.localhost:8081/mid'

[{"ID":40,"title":"some title","body":"some body 111111..","Author":"recoilme","Image":"http://sub.localhost:8081/a/33.png","ogimage":"","CreatedAt":"2018-10-08T18:50:14.598065282+03:00","Lang":"sub","HTML":"","Plus":0,"Minus":0,"Comments":null,"ReadingTime":0,"WordCount":3,"tag":""},{"ID":39,"title":"Title test fcm2","body":"Body test fcm2..","Author":"recoilme","Image":"http://sub.localhost:8081/a/33.png","ogimage":"","CreatedAt":"2018-10-08T18:48:39.295722411+03:00","Lang":"sub","HTML":"","Plus":0,"Minus":0,"Comments":null,"ReadingTime":0,"WordCount":3,"tag":""}]

Get next 20 from article id 20
curl --header "Content-type:application/json" 'http://sub.localhost:8081/mid?p=20'
response - similar

Get article
curl --header "Content-type:application/json" 'http://sub.localhost:8081/@username/19'

{"ID":19,"title":"","body":"efweffefwefwefewf","Author":"username","Image":"","ogimage":"","CreatedAt":"2018-08-09T14:06:18.313579468+03:00","Lang":"sub","HTML":"\u003cp\u003eefweffefwefwefewf\u003c/p\u003e\n","Plus":0,"Minus":0,"Comments":null,"ReadingTime":0,"WordCount":0,"tag":""}

Register
curl --header "Content-type:application/json" --request POST --data '{"username":"recoilme56","password":"password","privacy":"privacy","terms":"terms"}' http://sub.localhost:8081/register

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6IiIsIm5vanMiOiIiLCJ1c2VybmFtZSI6InJlY29pbG1lNTYifQ.xle4ofAfobpZh2_FbuCwNoVrVdR_mymohJIMfAUwLZQ

Login
curl -v --header "Content-type:application/json" --request POST --data '{"username":"recoilme56","password":"password"}' http://sub.localhost:8081/login

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbWFnZSI6IiIsIm5vanMiOiIiLCJ1c2VybmFtZSI6InJlY29pbG1lNTYifQ.xle4ofAfobpZh2_FbuCwNoVrVdR_mymohJIMfAUwLZQ"

Send new post to FCM

{"to":"sub/all","data":{"ID":40,"title":"some title","body":"some body 1111114444..","Author":"recoilme","Image":"http://sub.localhost:8081/a/33.png","ogimage":"","CreatedAt":"2018-10-08T18:50:14.598065282+03:00","Lang":"sub","HTML":"","Plus":0,"Minus":0,"Comments":null,"ReadingTime":0,"WordCount":3,"tag":""}}
@recoilme
Copy link
Owner Author

@vogster
Send delete post to FCM

{"to":"/topics/tst_del","data":{"ID":40,..}

@recoilme
Copy link
Owner Author

recoilme commented Oct 17, 2018

Errors

@vogster in case of errors api will return HTTP code 422 and json with error string:

{"error":"Error: key not found"}

@recoilme
Copy link
Owner Author

recoilme commented Oct 17, 2018

Post article

curl -v --header "Content-type:application/json" --header "Authorization:token somebigstring" --request POST --data '{"body":"recoilme5 passwor  pssword"}' http://sub.localhost:8081/editor/0

Update article
http://sub.localhost:8081/editor/ArticleId

@recoilme
Copy link
Owner Author

Post comment

curl -v --header "Content-type:application/json" --header "Authorization:token somebigstring" --request POST --data '{"body":"recoilme5 passwor  pssword"}' 'http://sub.localhost:8081/comments/@recoilme56/41'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant