Skip to content

Latest commit

 

History

History
130 lines (99 loc) · 2.12 KB

API.md

File metadata and controls

130 lines (99 loc) · 2.12 KB

Tent API

General

http Methods

  • GET: View
  • POST: Create
  • PUT: Update
  • DELETE: Delete

Error Response

{
	"error": "message with details"
}

Categories

List

GET /api/repo/ (200)

Sample Response:{ "categories": [ "catid_1", "catid_2" ] }

Details

GET /api/repo/category/:category (200 - 404)

Sample Response:{ "name": "Category name", "subcategories": [ "subid_1", "subid_2" ] }

Create

POST /api/repo/category/:category (201 - 409, 503)

Request Body:{ "name": "Category name" }

Update

PUT /api/repo/category/:category (204 - 503)

Request Body:{ "name": "Category name" }

Delete

DELETE /api/repo/category/:category (204 - 503)

Subcategories

Details

GET /api/repo/category/:category/:sub (200 - 404)

Sample Response:{ "name": "Subcategory name", "items": [ "itemid_1", "itemid_2" ] }

Create

POST /api/repo/category/:category/:sub (201 - 409, 503)

Request Body: { "name": "Subcategory name" }

Update

PUT /api/repo/category/:category/:sub (204 - 503)

Request Body: { "name": "Category name" }

Delete

DELETE /api/repo/category/:category/:sub (204 - 503)

Items

Details

GET /api/repo/category/:category/:sub/item/:item (200 - 404)

Sample Response:

{
	"hash": "sha1",
	"title": "Item Title",
	"body": "<h1>Sample Body</h1><p>some text</p>",
	"difficulty": "Beginner"
}```

### Create
**POST** /api/repo/category/:category/:sub/item/:item _(201 - 503)_

**Request Body**:

{ "title": "Item Title", "body": "

Sample Body

some text

", "difficulty": "Beginner" }```

Update

PUT /api/repo/category/:category/:sub/item/:item (204 - 409, 503)

Request Body:

{
	"hash": "sha1",
	"title": "Item Title",
	"body": "<h1>Sample Body</h1><p>some text</p>",
	"difficulty": "Beginner"
}```


### Delete
**DELETE** /api/repo/category/:category/:sub/item/:item _(204 - 503)_