Git Product home page Git Product logo

notify's Introduction

API request, response and urls description

View Create Message

HTTP method: POST

Url: https://daftcodenotify.herokuapp.com/message

Authorizations: required HTTPBasic

Parameters: none

Request body schema example: application/json:

{
    "content": "hello"
}

Responses samples:

Status symbol: 201

Status description: successful response

Content type: application/json

Response body:

{
    "msg": "You have created a message hello"
}

Status symbol: 422

Status description: validation error

Content type: application/json

The response body for a message with character length zero:

{
  "detail": [
    {
      "loc": [
        "body",
        "content"
      ],
      "msg": "ensure this value has at least 1 characters",
      "type": "value_error.any_str.min_length",
      "ctx": {
        "limit_value": 1
      }
    }
  ]
}

The response content for messages with a character length longer than 160:

{
  "detail": [
    {
      "loc": [
        "body",
        "content"
      ],
      "msg": "ensure this value has at most 160 characters",
      "type": "value_error.any_str.max_length",
      "ctx": {
        "limit_value": 160
      }
    }
  ]
}

View Show Message

HTTP method: GET

Url: https://daftcodenotify.herokuapp.com/message/{message_id}

Authorizations: not required

Path parameters: message_id, type: integer, required

Responses samples:

Status symbol: 200

Status description: successful response

Content type: application/json

Example Value:

{
  "content": "hello",
  "view_counter": 1
}

Status symbol: 404

Status description: error: not found

Content type: application/json

{
  "detail": "Message not found"
}

View Update Message

HTTP method: PATCH

Url: https://daftcodenotify.herokuapp.com/message/{message_id}

Authorizations: required HTTPBasic

Path parameters: message_id, type: integer, required

Request body schema example: application/json:

{
  "content": "hello again"
}

Responses samples:

Status symbol: 201

Status description: successful response

Content type: application/json

Example Value:

{
  "content": "hello again",
  "view_counter": 0
}

Status symbol: 404

Status description: error: not found

Content type: application/json

{
  "detail": "Message not found"
}

View Delete Message

HTTP method: DELETE

Url: https://daftcodenotify.herokuapp.com/message/{message_id}

Authorizations: required HTTPBasic

Path parameters: message_id, type: integer, required

Request body schema example: application/json:

Responses samples:

Status symbol: 201

Status description: successful response

Content type: application/json

Example Value:

{
  "msg": "Message id 1 has been deleted."
}

Status symbol: 404

Status description: error: not found

Content type: application/json

{
  "detail": "Message not found"
}

Check the urls in the terminal using the following commands

curl --request POST -u user:access --data '{"content": "hello"}' https://daftcodenotify.herokuapp.com/message
curl --request GET https://daftcodenotify.herokuapp.com/message/1
curl --request PATCH -u user:access --data '{"content": "hello again"}' https://daftcodenotify.herokuapp.com/message/1
curl --request DELETE -u user:access https://daftcodenotify.herokuapp.com/message/1

notify's People

Contributors

edyta-budny avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.