Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

[admin] backend_web API

Anton Žyliuk edited this page Mar 24, 2020 · 2 revisions

POST auth/login/

Authenticates user in the system, returns token which should be places in the 'Authorization: bearer ${token}' header to authorize request.

curl http://localhost:3000/auth/login -H "Content-Type: application/json" -d '{"email": "admin@admin.admin", "password": "12345678"}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODUyMzAyOTEsImRhdGEiOnsiZW1haWwiOiJhZG1pbkBhZG1pbi5hZG1pbiJ9LCJpYXQiOjE1ODQ5NzEwOTF9.BKcj9u7RATkMZ-jiXnATCwDQl0Tmuix2y-zDSqcJkFg"}

GET subscriptions/

Returns list of the emails subscriptions.

curl http://localhost:3000/su'authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODUyMzAyOTEsImRhdGEiOnsiZW1haWwiOiJhZG1pbkBhZG1pbi5hZG1pbiJ9LCJpYXQiOjE1ODQ5NzEwOTF9.BKcj9u7RATkMZ-jiXnATCwDQl0Tmuix2y-zDSqcJkFg' -H "Content-Type: application/json"
{"subscriptions":[{"email":"subscriber1@example.com"},{"email":"subscriber2@example.com"},{"email":"subscriber3@example.com"}]}

POST subscriptions/

Subscribes given email email. Not requires Authorization.

curl http://localhost:3000/subscriptions -H 'authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODUyMzAyOTEsImRhdGEiOnsiZW1haWwiOiJhZG1pbkBhZG1pbi5hZG1pbiJ9LCJpYXQiOjE1ODQ5NzEwOTF9.BKcj9u7RATkMZ-jiXnATCwDQl0Tmuix2y-zDSqcJkFg' -X POST -d '{"email": "subscriber1@example.com"}' -H "Content-Type: application/json"
{"status":"ok"}

POST publish/

Performs email publish to the subscribed emails.

curl http://localhost:3000/subscriptions/publish -H 'authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODUyMzAyOTEsImRhdGEiOnsiZW1haWwiOiJhZG1pbkBhZG1pbi5hZG1pbiJ9LCJpYXQiOjE1ODQ5NzEwOTF9.BKcj9u7RATkMZ-jiXnATCwDQl0Tmuix2y-zDSqcJkFg' -H "Content-Type: application/json" -X POST -d '{"subject": "Cool email", "text": "khm"}'
{"status":"ok"}

Clone this wiki locally