-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
Alan Long edited this page Aug 14, 2020
·
13 revisions
Poaster is a RESTful API (with standard exceptions for non-CRUD operations).
All authenticated endpoints require an Authorization: Bearer <token> header that identifies the logged in user. The only current unauthenticated endpoint is /api/sessions/sign_in, but this will change as we add support for posts, as we want the site accessible to non-logged in users as well for content discovery.
POST /api/sessions/sign_in- Required Headers: None
Response:
{
"data": {
"token": "SFMyNTY.g2gDYQFuBgB5dnztcwFiAAFRgA.fzywx25h5Xnvk2kaLChRjqunE_lyesGhKEdfgn7iebw"
}
}
DELETE /api/sessions/sign_out- Required Headers:
Authorization
Response: 204 No Content
POST /api/sessions/sign_in- Required Headers:
Authorization
Expected Body:
{
"revoke_token": "SFMyNTY.g2gDYQFuBgD82cfjcwFiAAFRgA.AqeROqv9rzadR0LNDvxotL-sd68vX0p4MzM9W7ve8Js"
}
Response:
{
"data": {
"token": "SFMyNTY.g2gDYQFuBgB5dnztcwFiAAFRgA.fzywx25h5Xnvk2kaLChRjqunE_lyesGhKEdfgn7iebw"
}
}
GET /api/users/me- Required Headers:
Authorization
Response:
{
"data": {
"user": {
"email": "alan.d.long@protonmail.com",
"personas": [
{
"background_image_url": "https://pbs.twimg.com/profile_banners/1169316135092858880/1578077577/1500x500",
"bio": "Software |☝🏻| Weightlifting | Localist | #Bitcoin | Prepper | Politically Weird | Straight Edge",
"id": 1,
"inserted_at": "2020-08-12T20:35:09",
"name": "A.D.🌺",
"profile_image_url": "https://pbs.twimg.com/profile_images/1266198123082395648/vCntW9rI_400x400.jpg",
"updated_at": "2020-08-12T20:35:09",
"username": "TacticalMinivan"
},
{
"background_image_url": null,
"bio": null,
"id": 65,
"inserted_at": "2020-08-14T04:03:00",
"name": null,
"profile_image_url": null,
"updated_at": "2020-08-14T04:03:00",
"username": "a"
},
],
"phone": "3142017135"
}
}
}
POST /api/personas- Required Headers:
Authorization
Body:
{
"username": "tacticalminivan"
}
Error Response: 400 Bad Request
{
"error": {
"detail": "You have reached your persona limit. Please purchase additional personas if you wish to create more!"
},
"success": false
}
Success Response: 201 Created
{
"persona": {
"background_image_url":null,
"bio":null,
"id":67,
"inserted_at":"2020-08-14T15:24:10",
"name":null,
"profile_image_url":null,
"updated_at":"2020-08-14T15:24:10",
"username":"tacticalminivan"
},
success":true
}