Bills

Get a list of all bills

ENDPOINT
  GET /bills

SAMPLE CALL
  curl -u [your_bullet_username]:[your_api_key] https://accounts-app-intl.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,
        "salesTaxCode": "STANDARD_2012",
        "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. "salesTaxCode" is a mandatory parameter when creating and updating bills. Sales Taxes for your company must be set up in Bullet before you start using the api. When creating a sales tax, you have to set a unique string "code" to identify the sales tax. It is this value that should be used for "salesTaxCode" field. 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-intl.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",
        "salesTaxCode": "STANDARD_2012",
        "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,
        "salesTaxCode": "STANDARD_2012",
        "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",
        "salesTaxCode": "STANDARD_2012",
        "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-intl.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,
        "salesTaxCode": "STANDARD_2012",
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "GRANT_INCOME"
    }]
}


Update a bill

"salesTaxCode" is a mandatory parameter when creating and updating bills. Sales Taxes for your company must be set up in Bullet before you start using the api. When creating a sales tax, you have to set a unique string "code" to identify the sales tax. It is this value that should be used for "salesTaxCode" field.

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",
        "salesTaxCode": "STANDARD_2012",
        "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-intl.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,
        "salesTaxCode": "STANDARD_2012",
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "SALES"
    }, {
        "id": 2,
        "salesTaxCode": "STANDARD_2012",
        "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-intl.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,
        "salesTaxCode": "STANDARD_2012",
        "description": "Laptop",
        "quantity": 1,
        "unitPrice": "500.00",
        "categoryCode": "GRANT_INCOME"
    }, {
        "id": 2,
        "salesTaxCode": "STANDARD_2012",
        "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-intl.bullethq.com/api/v1/bills/1/billLines


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 4,
    "salesTaxCode": "STANDARD_2012",
    "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-intl.bullethq.com/api/v1/bills/1/billLines/4


RESPONSE CODES
  200 - Successful call

SAMPLE RESPONSE
{
    "id": 4,
    "salesTaxCode": "STANDARD_2012",
    "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-intl.bullethq.com/api/v1/bills/1/billLines/4


RESPONSE CODES
  200 - Successful call

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