Code Monkey home page Code Monkey logo

api-todolist's Introduction

== README

Todo - API

This is the API of a public Todo List. It is based on REST (Representational State Transfer), which makes integration easier by using all the advantages that the HTTP protocol has to offer.

Note: The database is cleaned every night at midnight. Format

We use JSON (JavaScript Object Notation) for requests and responses. JSON is a lightweight data-interchange format that is easy to write and read by both machines and humans. JSON is more compact than XML, faster to analyze, and easier to interpret. Endpoints

The API of the Todo application exposes the following methods:

List Todo Items
Create Todo Item
Update Todo Item
Delete Todo Item

List Todo Items

To list all the items in the Todo List, make a GET call to the /todo_items endpoint:

GET http://mike-todolist.herokuapp.com/todo_items

Example

Copy and paste the following line to your console:

curl -i http://mike-todolist.herokuapp.com/todo_items

Result

If everything works as expected, you will receive a status 200 OK with the items in the body of the response:

[ { "title": "Item 1", "done": false, "create_at": "...", "updated_at": "" }, { "title": "Item 2", "done": true, "create_at": "...", "updated_at": "" }, { "title": "Item 3", "done": false, "create_at": "...", "updated_at": "" } ]

Create Todo Item

To add a new item to the Todo List, make a POST call to the /todo_items endpoint with the title of the item:

POST http://mike-todolist.herokuapp.com/todo_items

{ "title": "Item 1" }

Example

Copy and paste the following line to your console:

curl -i -X POST -H 'Content-Type: application/json' -d '{ "title": "Item 1" }' http://mike-todolist.herokuapp.com/todo_items

Result

If everything works as expected, you will receive a status 200 OK with the created item:

{ "id": 1, "title": "Item 1", "done": false, "create_at": "...", "updated_at": "" }

Update Todo Item

To update an item to the Todo List, make a PUT call to the /todo_items/<item_id> endpoint with the changes you want to make:

PUT http://mike-todolist.herokuapp.com.herokuapp.com/todo_items/<item_id>

{ "title": "Changed title", "done": true }

Example

Copy and paste the following line to your console:

curl -i -X PUT -H 'Content-Type: application/json' -d '{ "done": true }' http://mike-todolist.herokuapp.com/todo_items/1

Result

If everything works as expected, you will receive a status 204 No Content Delete Todo Item

To delete an item to the Todo List, make a DELETE call to the /todo_items/<item_id> endpoint:

DELETE http://mike-todolist.herokuapp.com/todo_items/<item_id>

Example

Copy and paste the following line to your console:

curl -i -X DELETE http://mike-todolist.herokuapp.com/todo_items/1

Result

If everything works as expected, you will receive a status 204 No Content

api-todolist's People

Contributors

mike-casas 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.