Skip to content

cardosorrenan/my_contacts_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Contacts API

My Contacts App: My Contacts

Setup

Python: 3.6.9v
Pip: 20.2.4v
1. Get repo
git clone https://github.com/cardosorrenan/my_contacts_api
2. Go to folder project
cd ./my_contacts_api
3. Install dependencies
pip install -r requirements.txt
4. Instantiate sqlite3 database and run migrations
python manage.py migrate 
5. Dump fake data
python manage.py loaddata my_contacts/fixtures/*.json
6. Create superuser (command for development purposes)
./manage.py createsuperuser2 --username renan --password 1234 --noinput --email 'renan@teste.com'
7. Run server
python manage.py runserver

API

Insomnia File - Download and import 🚀

Person

Model response

Person {
   id: number
   name: string
   favorite: boolean
   phones: Phone[]
   created_at: date
   updated_at: date
}

Endpoints

URL METHOD REQUEST BODY RESPONSE
INDEX /contacts/persons GET - Person[ ]
GET ONE /contacts/persons/{id} GET - Person
SAVE /contacts/persons POST name,
favorite
Person
EDIT /contacts/persons/{id} PATCH name,
favorite
Person
DELETE /contacts/persons/{id} DELETE - -

Phone

Model response

Phone {
   id: number
   number: string
   person: number
   created_at: date
   updated_at: date
}

Endpoints

URL METHOD REQUEST BODY RESPONSE
INDEX /contacts/phones GET - Phone[ ]
GET ONE /contacts/phones/{id} GET - Phone
SAVE /contacts/phones POST number,
person
Phone
EDIT /contacts/phones/{id} PATCH number,
person
Phone
DELETE /contacts/phones/{id} DELETE - -

About

server side for simple app to save your contacts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages