api

command module
v0.0.0-...-0ccf497 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2020 License: MIT Imports: 12 Imported by: 0

README

Keep It Later! API Endpoints

Get all items

Endpoint: http://localhost:8000/items

Method: GET

Response example:

[
  {
    "id": 4,
    "category_id": null,
    "category_name": null,
    "url": "https://www.dga.or.th/th/index.php"
  },
  {
    "id": 3,
    "category_id": "1",
    "category_name": "Personal",
    "url": "https://www.cookingchanneltv.com/"
  },
  {
    "id": 2,
    "category_id": "2",
    "category_name": "Technical",
    "url": "https://reactjs.org/"
  },
  {
    "id": 1,
    "category_id": "2",
    "category_name": "Technical",
    "url": "https://www.dataquest.io/blog/data-pipelines-tutorial/"
  }
]

Filter items by category

Endpoint: http://localhost:8000/items?category=2

Method: GET

Response example

[
  {
    "id": 2,
    "category_id": "2",
    "category_name": "Technical",
    "url": "https://reactjs.org/"
  },
  {
    "id": 1,
    "category_id": "2",
    "category_name": "Technical",
    "url": "https://www.dataquest.io/blog/data-pipelines-tutorial/"
  }
]

Create an item

Endpoint: http://localhost:8000/items

Method: POST

Request payload:

{
  "category_id": 2,
  "url": "https://www.google.com"
}

Response example:

{
  "id": 5,
  "category_id": {
    "String": "",
    "Valid": false
  },
  "category_name": {
    "String": "Technical",
    "Valid": true
  },
  "url": "https://www.google.com"
}

Delete an item

Endpoint: http://localhost:8000/items/{id}

Method: DELETE

Get all categories

Endpoint: http://localhost:8000/categories

Method: GET

Response example:

[
  {
    "id": 2,
    "name": "Personal"
  },
  {
    "id": 4,
    "name": "Knowledge"
  }
]

Create a category

Endpoint: http://localhost:8000/categories

Method: POST

Request payload:

{
  "name": "Cooking"
}

Response example:

{
  "id": 3,
  "name": "Cooking"
}

Delete a category

Endpoint: http://localhost:8000/categories/{id}

Method: DELETE

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL