Git Product home page Git Product logo

det-api's Introduction

API for det


Endpoints

All endpoints accept and return JSON. All endpoints are authenticated via token authentication and must include this header with valid token returned by login Authorization: Token token="a3caf3291c5b0469f2bb04e360438211"

Login

####POST /api/login

Logs in (or signs up if user is new) the user and passes back the user object Pass in a JSON object with key authToken and the access token provided by facebookSDK login

Parameters:

{"authToken":"CAABpBBdQZCT8BAK77qTxj9HQfj6f1xagQ5yGzftVZAzMsMGbGnRSRBNZAvg9wjL9z6NZCImLLlwDgdh2V4eSDLEgaGBSZAZBzF7jVfUk1lTC8vjoJClJP1e985u0jq708ZB4bEyjlZBy6blovedpzSlLsYSMnhvq0rBQxglWbP62iHcYe74ITY89u4RjRANkOnuaYxeHsu5ZBZBaZB93eeljCV0Tp28glnj74EZD"}

Response:

{ "id":2,
  "name":"Justin Huang",
  "facebook_id":"1141801215",
  "email":"[email protected]",
  "token":"a3caf3291c5b0469f2bb04e360438211",
  "created_at":"2014-02-20T18:14:54.000Z",
  "updated_at":"2014-02-20T18:14:54.000Z"
}

####POST /api/transaction

Creates a new transaction. You are always the creditor.

Parameters:

{ "debtors": [ 
    { "name" : "allen",
      "facebook_id" : "571815533",
      "amount" : "9282"
    },
    { "name" : "brian",
      "facebook_id" : "100000189248862",
      "amount" : "130"
    }],
  "transaction" : { "description" : "OMG RAILS API BITCHES"},
}

Response:

{ "transaction": 
    { "id":5,
      "description":"OMG RAILS API BITCHES",
      "created_at":"2014-02-20T21:17:03.406Z",
      "updated_at":"2014-02-20T21:17:03.406Z"
    },
  "debts":[
    { "id":6,
      "amount":"9282.0",
      "creditor":"1141801215",
      "debtor":"571815533",
      "created_at":"2014-02-20T21:17:03.443Z",
      "updated_at":"2014-02-20T21:17:03.443Z",
      "transaction_id":5},
    { "id":7,
      "amount":"130.0",
      "creditor":"1141801215",
      "debtor":"100000189248862",
      "created_at":"2014-02-20T21:17:03.449Z",
      "updated_at":"2014-02-20T21:17:03.449Z",
      "transaction_id":5}]
}

####GET /api/debts

Gets a list of debts that you are involved with.

Response:

[
  { "id":1,
    "amount":"9282.0",
    "creditor":"1141801215",
    "debtor":"571815533",
    "created_at":"2014-02-20T20:47:23.000Z",
    "updated_at":"2014-02-20T20:47:23.000Z",
    "transaction_id":2},
  { "id":2,
    "amount":"130.0",
    "creditor":"1141801215",
    "debtor":"100000189248862",
    "created_at":"2014-02-20T20:47:23.000Z",
    "updated_at":"2014-02-20T20:47:23.000Z",
    "transaction_id":2},
  { "id":3,
    "amount":"9282.0",
    "creditor":"1141801215",
    "debtor":"571815533",
    "created_at":"2014-02-20T21:16:06.000Z",
    "updated_at":"2014-02-20T21:16:06.000Z",
    "transaction_id":3},
  { "id":4,
    "amount":"130.0",
    "creditor":"1141801215",
    "debtor":"100000189248862",
    "created_at":"2014-02-20T21:16:06.000Z",
    "updated_at":"2014-02-20T21:16:06.000Z",
    "transaction_id":3}
]

####GET /api/debts/{facebook_id}

not complete

det-api's People

Contributors

rawrjustin avatar

Watchers

 avatar  avatar James Cloos avatar  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.