Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Latest commit

 

History

History
209 lines (150 loc) · 2.25 KB

README.md

File metadata and controls

209 lines (150 loc) · 2.25 KB

API Documentation

  • Author: Jack Jiang
  • Date: Jul. 2019

Overview

CRUD HTTP Method URL
Create POST @server/keys/
Read GET @server/keys/@key
Update PUT @server/keys/@key
Delete DELETE @server/keys/@key
Debug GET @server/debug/

Create Name

Send

  • URL: @server/keys/
  • HTTP Method: POST
  • Body:
{
    "key": @key,
    "firstName": "Jack",
    "LastName": "Jiang"
}

Response

succeed

  • HTTP Status Code: 201
  • Body:
{
    "key": @key,
    "firstName": "Jack",
    "LastName": "Jiang"
}

conflict

  • HTTP Status Code: 409
  • Body:
{
    "key": @key,
    "errorMsg": "conflict"
}

bad request

  • HTTP Status Code: 400
  • Body:
{
    "errorMsg": "bad request"
}

Read Name

Send

  • URL: @server/keys/@key
  • HTTP Method: GET
  • Body: Null

Response

succeed

  • HTTP Status Code: 200
  • Body:
{
    "key": @key,
    "firstName": "Jack",
    "LastName": "Jiang"
}

not found

  • HTTP Status Code: 404
  • Body:
{
    "key": @key,
    "errorMsg": "not found"
}

Update Name

Send

  • URL: @server/keys/@key
  • HTTP Method: PUT
  • Body:
{
    "firstName": "Jack",
    "LastName": "Jiang"
}

Response

succeed

  • HTTP Status Code: 200
  • Body:
{
    "key": @key,
    "firstName": "Jack",
    "LastName": "Jiang"
}

not found

  • HTTP Status Code: 404
  • Body:
{
    "key": @key,
    "errorMsg": "key not found"
}

bad request

  • HTTP Status Code: 400
  • Body:
{
    "errorMsg": "bad request"
}

Delete Name

Send

  • URL: @server/keys/@key
  • HTTP Method: DELETE
  • Body: Null

Response

Succeed

  • HTTP Status Code: 200
  • Body:
{
    "key": @key,
    "firstName": "Jack",
    "LastName": "Jiang"
}

Fail

  • HTTP Status Code: 404
  • Body:
{
    "key": @key,
    "errorMsg": "key not found"
}

Debug Method

database will be printed out on back-end terminal

  • URL: @server/debug/
  • HTTP Method: GET
  • Body: Null