Giter VIP home page Giter VIP logo

todo's Introduction

Todo Test Application

Application deployed on heroku: https://mashapetodo2.herokuapp.com. Before using application, you have to verify your phone in Twilio system. We are using trial account and that is why you have to do that. Otherwise application will not be able send SMS notification. You can add & verify your number on this page https://www.twilio.com/user/account/phone-numbers/verified

Rest API

  • Main prefix for rest api is "/api". We have 2 services /api/session and /api/todo
  • Some API are described below, but this list doesn't show all possibilities. Please look at the code.
  • This API requires cookies. Session token is passing through cookie and you have to make sure that you receiving cookies and sending them back

/session

  • I had to add simple sessions, just for be able send sms notifications to users. Session has only one key - phone. So it means that anyone can create as many sessions as he wants. We don't care.
  • There is validation for some API calls but not for all of them.

Create new session

POST /api/session HTTP/1.1
Host: mashapetodo2.herokuapp.com
Content-Type: application/json
Cache-Control: no-cache

{ "phone":"+15122399903" }

Destroy session

DELETE /api/session HTTP/1.1
Host: mashapetodo2.herokuapp.com
Cache-Control: no-cache

/todo

Todo is main entity in application. /todo service allows you make CRUD operations with todo. Also make search through searchbox.io.

Add new todo

POST /api/todo HTTP/1.1
Host: mashapetodo2.herokuapp.com
Content-Type: application/json
Cache-Control: no-cache

{ "title":"titlea", "body":"bodya" }

Update todo

When you making update todo and status is changing from done=false to done=true, application sends SMS notification about that to the phone number from session.

PUT /api/todo HTTP/1.1
Host: mashapetodo2.herokuapp.com
Content-Type: application/json
Cache-Control: no-cache

{ "id": "5404da55e4b0de32d0ab0db0", "title": "titlea2", "body": "bodya2", "done": false }

Remove todo

DELETE /api/todo HTTP/1.1
Host: mashapetodo2.herokuapp.com
Content-Type: application/json
Cache-Control: no-cache

{ "id": "5404da55e4b0de32d0ab0db0", "phone": "+15122399902" }

Get todo list

GET /api/todo HTTP/1.1
Host: mashapetodo2.herokuapp.com
Accept: application/json
Cache-Control: no-cache

Search

You can add search query as url parameter to GET request

GET /api/todo?q=test HTTP/1.1
Host: mashapetodo2.herokuapp.com
Accept: application/json
Cache-Control: no-cache

Front End

Front end has been built with ionic framework. Search on todo list doesn't use search from rest api. It is just UI filter.

todo's People

Contributors

manusovich avatar

Watchers

 avatar

todo's Issues

API, getting a 403 error

I was trying to consume the API directly, but I get a 403 Forbidden error when making the following request:

curl -i -H "Accept: application/json" https://mashapetodo2.herokuapp.com/api/todo

Which returns:

HTTP/1.1 403 Forbidden
Connection: keep-alive
Server: Apache-Coyote/1.1
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Content-Type: application/json
Content-Length: 45
Date: Tue, 02 Sep 2014 18:56:21 GMT
Via: 1.1 vegur

{"status":403,"message":"HTTP 403 Forbidden"}

I wonder if the URL I'm requesting is correct.

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.