This describes the resources that make up the official Rebase API by drakeet.
If you have any problems or requests please contact drakeet or create an issue.
All API access is over HTTPS, and accessed from the https://server/rebase
. All data is sent and received as JSON.
Content-Type: application/json; charset=utf-8
All timestamps are returned in ISO 8601 format:
YYYY-MM-DDTHH:MM:SSZ
Many APIs take optional parameters. For GET requests, any parameters not specified as a segment in the path can be passed as an HTTP query string parameter:
GET https://api.drakeet.com/rebase/categories/drakeet/fun/feeds?size=15&last_id=123
For POST, PATCH, PUT, and DELETE requests, parameters not included in the URL should be encoded as JSON with a Content-Type
of application/json
.
Access token is required for all POST, PATCH, PUT, and DELETE requests, except for user register
.
Header
Authorization: token YOUR-TOKEN
There is only one type of errors on API calls.
Status 4xx Description
{
"error": "Not Found"
}
Request
GET /
Return
text/html
Api index
Request
POST /markdown
name | type | description |
---|---|---|
body | string | Markdown |
Response
Rendered HTML of given markdown
Errors
Response 422 if render failure
Request
GET /version
Response
0.7.0
GET /datastorage
Response
Content-Type
is application/json
This is an internal, undocumented API
By default, all the UGCs are public, but only the owner can publish or change (owned) categories and feeds.
POST /users
Input
Name | Type | Description |
---|---|---|
username | string | Required. username of the user. It's immutable |
password | string | Required. password of the user, will be stored with SHA hash |
name | string | Required. name of the user |
string | Required. email of the user to contact | |
description | string | Required. description of the user |
Response
Status: 201 Created
Location: https://server/rebase/users/drakeet
{
"username": "drakeet",
"name": "drakeet",
"email": "[email protected]",
"description": "an Android developer.",
"authorization": {
"access_token": "431240f28f0637a640a051fce3632a88463dcc0o",
"updated_at": "2017-02-02T20:40:42+0800"
},
"created_at": "2017-02-02T20:40:42+0800"
}
GET /authorizations/:username
Parameters
Name | Type | Description |
---|---|---|
password | string | The password of the user |
Response
Status: 200 OK
{
"access_token": "e72e16c7e42f292c6912e7710c838347ae178b4a",
"updated_at": "2017-02-02T20:40:42+0800"
}
One user can create up to 11 categories.
GET /categories/:owner
Response
Status: 200 OK
[
{
"key": "a key",
"name": "a name of the category",
"rank": 1,
"owner": "drakeet"
},
{
"key": "a key",
"name": "a name of the category",
"rank": 2,
"owner": "drakeet"
}
]
POST /categories/:owner
Parameters
Name | Type | Description |
---|---|---|
key | string | Required. The key of the category. It's the id of the category |
name | string | Required. The name of the category |
rank | number | Default: 0. The rank of the category |
Response
Status: 201 Created
Location: https://api.drakeet.com/rebase/categories/drakeet/cat
{
"key": "a key",
"name": "a name of the category",
"rank": 1,
"owner": "drakeet"
}
A feed may contain anything relating to its category.
GET /categories/:owner/:category/feeds
Parameters
Name | Type | Description |
---|---|---|
last_id | string | Default: null. The last feed id of the feeds |
size | number | Default: 20. The size of the feeds |
Response
Status: 200 OK
[
{
"_id": "1",
"title": "a title",
"content": "a content",
"url": "an url",
"category": "a category",
"owner": "an owner",
"cover_url": "a cover url",
"created_at": "2017-02-11T10:51:07+0800",
"updated_at": "2017-02-11T11:51:07+0800",
"published_at": "2017-02-11T20:40:42+0800"
},
{
"_id": "2",
"title": "a title",
"content": "a content",
"url": "an url",
"category": "a category",
"owner": "an owner",
"cover_url": "a cover url",
"created_at": "2017-02-11T10:51:07+0800",
"updated_at": "2017-02-11T11:51:07+0800",
"published_at": "2017-02-11T20:40:42+0800"
}
]
POST /categories/:owner/:category/feeds
Input
Name | Type | Description |
---|---|---|
title | String | Required. The title of the feed |
content | String | The content of the feed |
url | String | The target URL of the feed |
cover_url | String | The cover URL of the feed |
Response
Status: 201 Created
Location: https://server/rebase/categories/drakeet/fun/feeds/5883235334b352758f6617d8
{
"_id": "1",
"title": "a title",
"content": "a content",
"url": "an url",
"category": "a category",
"owner": "an owner's username",
"cover_url": "a cover url",
"created_at": "2017-02-11T10:51:07+0800",
"published_at": "2017-02-11T20:40:42+0800"
}
PATCH /categories/:owner/:category/feeds/:_id
Input
Name | Type | Description |
---|---|---|
title | string | Optional. The title of the feed |
content | string | Optional. The content of the feed |
url | string | Optional. The target URL of the feed |
cover_url | string | Optional. The cover URL of the feed |
category | string | Optional. The category of the feed |
Example
{
"title": "a new title"
}
Response
Status: 200 OK
{
"_id": "1",
"title": "a new title",
"content": "a content",
"url": "an url",
"category": "a category",
"owner": "an owner's username",
"cover_url": "a cover url",
"created_at": "2017-02-11T10:51:07+0800",
"published_at": "2017-02-11T20:40:42+0800",
"updated_at": "2017-02-13T20:40:42+0800"
}
DELETE /categories/:owner/:category/feeds/:_id
Response
Status: 204 No Content