blog-api

command module
v0.0.0-...-9438e6f Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 15 Imported by: 0

README

Blog API

A simple and unsecure API to store blog data. The server limit the number of request from an IP at 264 per minute.

Store Article

Add an article in the database.

  • URL:

    /article/{id}/

  • Method:

    POST

  • URL Param:

    required:
    id=[string] represents an user ID

  • Data Param:

    {
        "title": "My Article",
        "content": "Whatever I want to say!"
    }
    
  • Success Response:

    Code: 200 OK
    Content:

    {
        "title": "My Article",
        "content": "Whatever I want to say!"
    }
    
  • Error Response:

    Code: 400 Bad Request
    Content: error as plain/text

    Code: 500 Internal Server Error
    Content: error as plain/text

Get Article

Get an article from the database.

  • URL:

    /article/{id}/{title}

  • Method:

    GET

  • URL Param:

    required:
    id=[string] represent an user ID
    title=[string] represent the title of an article

  • Data Param:

    None

  • Success Response:

    Code: 200 OK
    Content:

    {
        "title": "My Article",
        "content": "Whatever I want to say!"
    }
    

Delete Article

Delete an article from the database.

  • URL:

    /article/{id}/{title}

  • Method:

    DELETE

  • URL Param:

    required:
    id=[string] represent an user ID
    title=[string] represent the title of an article

  • Data Param:

    None

  • Success Response:

    Code: 200 OK
    Content: None

  • Error Response:

    Code: 400 Bad Request
    Content: error as plain/text

    Code: 404 Not Found
    Content: error as plain/text

    Code: 500 Internal Server Error
    Content: error as plain/text

Get All Article

Get all article from an user.

  • URL:

    /articles/{id}/{order}/

  • Method:

    GET

  • Headers:

    optional:
    Accept: text/xml ask the server to send data as XML

  • URL Param:

    required:
    id=[string] represent an user ID

    optional:
    order=[desc|asc] ask the server to order in an ascending or descending way

  • Data Param:

    None

  • Success Response:

    Code: 200 OK
    Content:

    [{
        "title": "My Article",
        "content": "Whatever I want to say!"
    },{
        "title": "My Other Article",
        "content": "Whatever I want to add!"
    }]
    
  • Error Response:

    Code: 400 Bad Request
    Content: error as plain/text

    Code: 404 Not Found
    Content: error as plain/text

    Code: 500 Internal Server Error
    Content: error as plain/text

Delete All Article

Delete all article from an user.

  • URL:

    /articles/{id}/

  • Method:

    DELETE

  • URL Param:

    required:
    id=[string] represent an user ID

  • Data Param:

    None

  • Success Response:

    Code: 200 OK
    Content: None

  • Error Response:

    Code: 400 Bad Request
    Content: error as plain/text

    Code: 404 Not Found
    Content: error as plain/text

    Code: 500 Internal Server Error
    Content: error as plain/text

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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