-
Notifications
You must be signed in to change notification settings - Fork 0
Bills
Christian Mikalsen edited this page Oct 16, 2011
·
9 revisions
Bills are the central resource in the Splitabill service, and the subject of most API operations.
A bill groups participants, expenses and messages. Based on the participants and expenses in the bill, the balance and settlement is automatically calculated.
Bills look like this:
{
{
"slug": "pTu",
"title": "Cabin trip",
"description": "Our weekend trip.",
"added_date": "2011-10-16 10:03:54",
"reminders": true,
"settlement_wait": false,
"settlement_status": 1,
"created_by": {
"id": 33609,
"name": "John Doe",
"email": "example@splitabill.com",
"payment_info": ""
},
"participants": [
{
"id": 33609,
"name": "John Doe",
"email": "example@splitabill.com",
"payment_info": ""
},
{
"id": 33610,
"name": "Jane Doe",
"email": "janedoe@example.org",
"payment_info": ""
}
],
"expenses": [
{
"id": 146735,
"description": "Gas",
"amount": "100.00",
"added_date": "2011-10-16 10:04:27",
"paid_by": {
"id": 33609,
"name": "John Doe",
"payment_info": "",
"email": "example@splitabill.com"
},
"split_between": []
},
{
"id": 146736,
"description": "Food",
"amount": "150.00",
"added_date": "2011-10-16 10:04:41",
"paid_by": {
"id": 33609,
"name": "John Doe",
"email": "example@splitabill.com",
"payment_info": ""
},
"split_between": [
{
"id": 33609,
"name": "John Doe",
"email": "example@splitabill.com",
"payment_info": ""
}
]
}
],
"messages": [
{
"id": 16135,
"message": "Hello world!",
"posted_date": "2011-10-16 10:04:49",
"posted_by": {
"id": 33609,
"name": "John Doe",
"email": "example@splitabill.com",
"payment_info": ""
}
}
]
}
}| Field | Editable | Description |
|---|---|---|
slug |
No | Unique ID for the bill |
title |
Yes (required) | The bill's title |
description |
Yes | Optional free-text description |
added_date |
No | Date of creation |
reminders |
Yes | Indicates if automatic reminders should be sent. |
settlement_wait |
Yes | Indicates if the bill is complete and should be settled. |
settlement_status |
No | Code indicating if the bill is settled for the user (0=empty, 1=unsettled, 2=settled). |
The following two operations return a list of bills.
| Operation | Method | URL |
|---|---|---|
| Get unsettled bills | GET |
/bills/ |
| Get all bills | GET |
/bills/all/ |
Sample response:
{
"bills": [
<list of bills>
]
}Bills can be fetched individually using their slug.
| Operation | Method | URL |
|---|---|---|
| Get a bill | GET |
/bills/<slug>/ |
Sample response:
{
"bill": [
<single bill>
]
}Bills are created by passing the bill's fields to one of the following URLs.
| Operation | Method | URL |
|---|---|---|
| Create a bill | POST |
/bills/create/ |
| Update a bill | POST |
/bills/<slug>/settings/ |
Sample request:
{
"title": "Cabin trip",
"description": "Our weekend trip.",
"reminders": false,
"settlement_wait": false
}Sample response:
{
"bill": [
<bill>
]
}