Skip to content

A simple REST API written in Python for performing CRUD operations on user data.

Notifications You must be signed in to change notification settings

armanvaziri/User-RestApi-Py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

REST API for user data

Usage

All responses will have the form

{
	"data": {
		"name": "name of the user",
		"age": "age of the user",
		"occupation": "occupation of the user"
	},
	"message": "Description of what happened"
}

Subsequent response definitions will only detail the expected value of the 'data field'

List all users

Definition

'GET /users'

Response

  • '200 OK' on success
[
	{
        "name": "Arman",
        "age": 20,
        "occupation": "Student"
    },
    {
        "name": "Matt",
        "age": 30,
        "occupation": "Teacher"
    }
]

Adding a new user

Definition

'POST /user/name'

ARGUMENTS

  • "name":string a globally unique identifier for the user's name
  • "age":int the user's age
  • "occupation":string the user's current occupation

RESPONSE

  • 201 Created on success
{
    "name": "Arman",
    "age": 20,
    "occupation": "Student"
}

Lookup user details

'GET /user/name'

Response

  • '404 Not Found' if the user does not exist
  • '200 OK' on success
{
    "name": "Arman",
    "age": 20,
    "occupation": "Student"
}

Instructions for use with Postman application

  1. Navigate to the directory where data.py is located
  2. run "python app.py" in the terminal
  3. Open Postman application
  4. Enter the http provided in the terminal when you ran the file

About

A simple REST API written in Python for performing CRUD operations on user data.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages