Bills

Get a list of all bills

ENDPOINT
  GET /bills

SAMPLE CALL
  curl -u [your_bullet_username]:[your_api_key] https://accounts-app.bullethq.com/api/v1/bills


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE

[{
    "id": 1,
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "type": "STOCK",
    "outstandingAmount": "615.00",
    "supplierName": "My Supplier",
    "supplierId": 1,
    "billLines": [{
        "id": 1,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "GRANT_INCOME"
    }]
}]

Create a bill

When creating a bill, you'll need to supply a "categoryCode" value. The codes for the categories are found by looking at Chart of Accounts page and selecting an account to view. Also, instead of the "supplierName" it is also possible to pass "supplierId". To find out the id of your suppliers, you can use the Suppliers api call. Finally, there's a "type" field. The valid values for this are "STOCK", "ASSET", "EXPENSE" and "SERVICE"

ENDPOINT
  POST /bills


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @createBill.json \
    -X POST \
    https://accounts-app.bullethq.com/api/v1/bills/

SAMPLE createBill.json
{
    "supplierName": "My Supplier",
    "currency": "EUR",
    "issueDate": "2013-01-01",
    "dueDate": "2013-02-01",
    "type": "STOCK",
    "billLines": [{
        "quantity": 1,
        "unitPrice": "500",
        "vatRate": 0.23,
        "description": "Laptop",
        "categoryCode": "SALES"
    }]
}

RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "outstandingAmount": "615.00",
    "id": 1,
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "type": "STOCK",
    "supplierName": "My Supplier",
    "supplierId": 1,
    "billLines": [{
        "id": 1,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "TRADE_PAYABLES",
    }]
}


To create a bill in a different currency, your json would look like :

{
    "supplierName": "My USD Supplier",
    "currency": "USD",
    "issueDate": "2013-01-01",
    "dueDate": "2013-02-01",
    "type": "STOCK",
    "billLines": [{
        "quantity": 1,
        "unitPrice": "500",
        "vatRate": 0.23,
        "description": "Laptop",
        "categoryCode": "SALES"
    }]
}

Get a bill

ENDPOINT
  GET /bills/[bill_id]


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -X GET \
    https://accounts-app.bullethq.com/api/v1/bills/


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE

{
    "id": 1,
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "type": "STOCK",
    "outstandingAmount": "615.00",
    "supplierName": "My Supplier",
    "supplierId": 1,
    "billLines": [{
        "id": 1,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "GRANT_INCOME"
    }]
}


Update a bill

ENDPOINT
  PUT /bills/[bill_id]

SAMPLE updateBill.json

{
    "supplierName": "My Supplier",
    "currency": "EUR",
    "issueDate": "2013-01-01",
    "dueDate": "2013-02-01",
    "type": "STOCK",
    "billLines": [{
        "quantity": 3,
        "unitPrice": "100",
        "vatRate": 0.23,
        "description": "Laptop",
        "categoryCode": "TRADE_PAYABLES"
    }]
}


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @updateBill.json \
    -X PUT \
    https://accounts-app.bullethq.com/api/v1/bills/1


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "outstandingAmount": "984.00",
    "id": 1,
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "type": "STOCK",
    "supplierName": "My Supplier",
    "supplierId": 1,
    "billLines": [{
        "id": 1,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "SALES"
    }, {
        "id": 2,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 3,
        "unitPrice": "100.00",
        "categoryCode": "GRANT_INCOME"
    }]
}

Delete a bill

ENDPOINT
  DELETE /bills/[bill_id]

SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key]  \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -X DELETE \
    https://accounts-app.bullethq.com/api/v1/bills/1

RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 1,
    "currency": "EUR",
    "dueDate": "2013-02-01",
    "issueDate": "2013-01-01",
    "type": "STOCK",
    "supplierName": "My Supplier",
    "supplierId": 1,
    "outstandingAmount": "984.00",
    "billLines": [{
        "id": 1,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "GRANT_INCOME"
    }, {
        "id": 2,
        "vatRate": 0.23,
        "description": "Laptop",
        "quantity": 3,
        "unitPrice": "100.00",
        "categoryCode": "TRADE_PAYABLES"
    }]
}

Add a bill line

ENDPOINT
  POST /bills/[bill_id]/billLines/

SAMPLE addBillLine.json

{
    "quantity" : 1,
    "unitPrice" : "1500",
    "vatRate" : 0.23,
    "description" : "Desk",
    "categoryCode" : "EXPENSES"
}



SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @addBillLine.json \
    -X POST \
    https://accounts-app.bullethq.com/api/v1/bills/1/billLines


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 4,
    "vatRate": 0.23,
    "description": "Desk",
    "quantity": 1,
    "unitPrice": "1,500.00",
    "categoryCode": "GRANT_INCOME"
}

Update a bill line

ENDPOINT
  PUT /bills/[bill_id]/billLines/[bill_line_id]

SAMPLE updateBillLine.json

{
    "quantity" : 2,
    "unitPrice" : "1500",
    "vatRate" : 0.23,
    "description" : "Desk",
    "categoryCode" : "EXPENSES"
}


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    --data @updateBillLine.json \
    -X PUT \
    https://accounts-app.bullethq.com/api/v1/bills/1/billLines/4


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 4,
    "vatRate": 0.23,
    "description": "Desk",
    "quantity": 2,
    "unitPrice": "1,500.00",
    "categoryCode": "GRANT_INCOME"
}

Delete a bill line

ENDPOINT
  DELETE /bills/[bill_id]/billLines/[bill_line_id]


SAMPLE CALL
    curl -u [your_bullet_username]:[your_api_key] \
    -H "Accept: application/json" \
    -H "Content-type: application/json" \
    -X DELETE \
    https://accounts-app.bullethq.com/api/v1/bills/1/billLines/4


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 4,
    "vatRate": 0.23,
    "description": "Desk",
    "quantity": 2,
    "unitPrice": "1,500.00",
    "categoryCode": "GRANT_INCOME"
}