Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 1.89 KB

api_.md

File metadata and controls

106 lines (74 loc) · 1.89 KB

#/api

Insert new Prayer

Insert a new Prayer into the Database prayer contains a text, and a public flag

URL

  • /api

Method:

  • POST

Data Params

  • Content: { "prayer": <TEXT>, "is_public": <BOOL> }

Success Response:

  • Code: 200

Error Response:

  • Code: 400 INVALID REQUEST
    • Reason invalid json format
  • Code: 500 INTERNAL SERVER ERROR
    • Reason database error

Get Prayers

Get all prayers of today from the database

URL

  • /api

Method:

  • GET

URL Params

  • Required: key=[string] (key authentication)

Success Response:

  • Code: 200
    • Content: array of all prayers of today
    [
     { 
       "id" : "<int>", 
       "prayer" : "<text>",
       "is_public" : "<bool>" , 
       "approved" : "<bool>", 
       "date" : "<datetime>" 
     },
      ...
    ]

Error Response:

  • Code: 401 UNAUTHORIZED
  • Code: 500 INTERNAL SERVER ERROR
    • Reason database error

Change Prayer

Insert a new Prayer into the Database prayer contains a text, and a public flag

URL

  • /api

Method:

  • PUT

URL Params

  • Required: key=[string] (key authentication)

Data Params

  • Content: { "id": <int>, "prayer" : <text>, "is_public": <BOOL> "approved": <BOOL> }

Success Response:

  • Code: 200

Error Response:

  • Code: 401 UNAUTHORIZED
  • Code: 400 INVALID REQUEST
    • Reason: invalid json format
  • Code: 500 INTERNAL SERVER ERROR
    • Reason: database error