Skip to content

Awesome API is an example REST API using Django REST framework

Notifications You must be signed in to change notification settings

aliminaei/awesome-api

Repository files navigation

awesome-api

Awesome API is an example REST API using Django REST framework. Try our live interactive docs or Deploy

Requirements

It is tested with the following versions. Add the missing packages to the requirements.txt of your Django project

  1. Python
  2. pip
  3. Django ver. 1.9.7
  4. django-filter ver. 0.13.0
  5. djangorestframework ver. 3.4.6
  6. Markdown ver. 2.6.6
  7. gunicorn ver. 19.6.0
  8. whitenoise ver. 3.2.1
  9. drfdocs ver. 0.0.11

Installation

  1. Clone this repo git clone https://github.com/aliminaei/awesome-api.git
  2. pip install -r requirements.txt
  3. python manage.py collectstatic --noinput
  4. python manage.py test
  5. python manage.py runserver 0.0.0.0:8080
  6. Go to api docs

API Usage

Create a new API User [POST /api/users/]

  • Parameters

    • username: (required, unique, string, min length=3, max length=254) - The username of the API user in form of a string.
    • email: (required, string, max length=254) - The email address of the API user in form of a string.
    • password (required, string, min length=3, max length=254) - The password of the API user in form of a string.
    • first_name (optional, string, max length=254) - The first name of the API user in form of a string.
    • last_name (optional, string, max length=254) - The last name of the API user in form of a string.
  • Request (application/json)

    • Body
        {
            "username": "username",
            "password": "password",
            "email": "mail@mail.com"
            "first_name": "fname",
            "last_name": "lname",
        }
  • Response 201

    • Body
        {
            "username": "username",
            "email": "mail@mail.com"
            "first_name": "fname",
            "last_name": "lname",
        }

Retrive the list of all API Users [GET /api/users/]

  • Response 200

    • Body
        [
            {
                "username": "username",
                "email": "mail@mail.com"
                "first_name": "fname",
                "last_name": "lname",
            },
            {
                "username": "username2",
                "email": "mail2@mail.com"
                "first_name": "fname2",
                "last_name": "lname2",
            },
            {
                "username": "username3",
                "email": "mail3@mail.com"
                "first_name": "fname3",
                "last_name": "lname3",
            }
        ]

Retrive the details of an API Users [GET /api/users/{username}]

  • Path Parameters

    • username: (required, unique, string, min length=3, max length=254) - The username of the API user in form of a string.
  • Response 200

    • Body
        {
            "username": "username",
            "email": "mail@mail.com"
            "first_name": "fname",
            "last_name": "lname",
        }

Delete the API Users [DELETE /api/users/{username}]

  • Path Parameters

    • username: (required, unique, string, min length=3, max length=254) - The username of the API user in form of a string.
  • Header Parameters

    • api-secret: (required, unique, string, max length=254) - Your api secret.
  • Request

    • Example
        curl -X DELETE  'http://127.0.0.1:8000/api/users/{username}/'  -H "HTTP_API_SECRET: {api-secret}"
    
  • Response 204

About

Awesome API is an example REST API using Django REST framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published