Skip to content

This API was developed to solve a coding challenge suggested by CodeLeap. It simulates a CRUD of posts inside a social network.

Notifications You must be signed in to change notification settings

SpackiGabriel/codeleap-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Codeleap Challenge

This API was developed to solve a coding challenge suggested by CodeLeap.

Run locally

python3 -m venv env
source env/bin/activate
pip install djangorestframework

cd api
python .\manage.py runserver

Endpoints

List all posts

GET http://localhost:8000/careers/
[
    {
        "id": 1,
        "username": "GabrielSpacki",
        "created_datetime": "2024-02-29T05:14:38.528455Z",
        "title": "My First Post",
        "content": "Hello, World!"
    },
    {
        "id": 2,
        "username": "LauraSilvestrin",
        "created_datetime": "2024-02-29T05:15:03.986621Z",
        "title": "Hey!!",
        "content": "Hello, Everyone!"
    },
    {
        "id": 3,
        "username": "LauraSilvestrin",
        "created_datetime": "2024-02-29T05:15:59.723869Z",
        "title": "Hey!!",
        "content": "fixed!"
    },
]

Create a new post

POST http://localhost:8000/careers/

Input

  {
    "username": "GabrielSpacki",
    "title": "Example of a new post!",
    "content": "Type something nice here :)"
  },

Output

  {
    "id": 1,
    "username": "GabrielSpacki",
    "created_datetime": "2024-02-29T05:14:38.528455Z",
    "title": "Example of a new post!",
    "content": "Type something nice here :)"
  },

Update post

PATCH http://localhost:8000/careers/${id}/
Parameter Type Description
id integer Mandatory. The ID of the post that you're updating

Input

  {
    "title": "Example of a new post! (Updated)",
    "content": "Type something great here :)"
  },

Output

  {
    "id": 1,
    "username": "GabrielSpacki",
    "created_datetime": "2024-02-29T05:14:38.528455Z",
    "title": "Example of a new post! (Updated)",
    "content": "Type something great here :)"
  },

Delete post

DELETE http://localhost:8000/careers/${id}/
Parameter Type Description
id integer Mandatory. The ID of the post that you're updating

Output

{}

About

This API was developed to solve a coding challenge suggested by CodeLeap. It simulates a CRUD of posts inside a social network.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages