trabian / hyperlocal-api

node.js-based mock API backend for Hyperlocal
https://github.com/trabian/hyperlocal-api/wiki
0 stars 0 forks source link

Addition to Accounts API #6

Closed trabianmatt closed 13 years ago

trabianmatt commented 13 years ago

This issue may be more informational than actionable because I already added this to the API, but feel free to make suggestions or completely trash the idea.

While developing the mobile banking interface I found it helpful to return the last few transactions for the accounts while fetching them from the API. Here's an example from the mock API:

GET http://localhost:3001/members/123001/accounts.json?transactions=3

{
    "data": [{
        "id": "123001-S10",
        "name": "Checking",
        "nickname": "My Checking Account",
        "balance": 8460.98,
        "available_balance": 8360.34,
        "transactions": [{
            "_id": "4e04bd9c4f63bf0000000002",
            "account_id": "123001-S10",
            "name": "THE OLIVE GARD00018051     NOBLESVILLE    IN",
            "amount": -59.11,
            "posted_at": "2011-06-24T10:53:52.168Z"
        }, {
            "_id": "4e04bd9c4f63bf0000000001",
            "account_id": "123001-S10",
            "name": "CHILDREN'S MUSEUM BOX      INDIANAPOLIS   IN",
            "amount": -171.39,
            "posted_at": "2011-06-24T08:44:52.167Z"
        }, {
            "_id": "4e04bd9c4f63bf0000000004",
            "account_id": "123001-S10",
            "name": "UNCLE BILLS PET CENTER     FISHERS        IN",
            "amount": -63.28,
            "posted_at": "2011-06-23T14:54:52.168Z"
        }]
    }, {
        "id": "123001-S1",
        "name": "Share Savings",
        "nickname": "My Share Savings Account",
        "balance": 209.26,
        "available_balance": 38.75,
        "transactions": []
    }, {
        "id": "123001-L21",
        "name": "Home Equity Line of Credit",
        "balance": -19348.16,
        "available_balance": 20651.84,
        "transactions": []
    }]
}

The update to the API is on the wiki at https://github.com/trabian/hyperlocal-api/wiki/ApiAccount or you can see what changed.

The commit for the update to the mock backend is here: https://github.com/trabian/hyperlocal-api/commit/ad21ede6699def6c828e70299e35d01b8401b346