Introducing REST Opening Balances endpoint

Introducing REST Opening Balances endpoint

Today we are happy to introduce the new Opening Balances REST endpoint, that will ease the pain of migrating an existing business to Reviso. Opening balances are a special kind of vouchers that allows to set a starting balance on a Customer, Supplier or Account. Technically speaking, they have a dedicated Number Series. An opening balance will have a list of entries or lines. Each line can only have one of either Account, Customer or Supplier specified.

Create a draft Opening Balance

Let me show you how yo create a minimal opening balance draft. The following request will create an opening balance with 4 lines: 2 for certain accounts, 1 for a customer and 1 for a supplier.

POST /opening-balances/drafts

{
    "date": "2018-01-01",
    "lines": [
        {
            "account": {
                "accountNumber": 13101
            },
            "amountInBaseCurrency": 1884117,
            "text": "Opening entry"
        },
        {
            "customer": {
                "customerNumber": 1
            },
            "amountInBaseCurrency": 4000,
            "text": "Opening entry"
        },
        {
            "supplier": {
                "supplierNumber": 1
            },
            "amountInBaseCurrency": -7835,
            "text": "Opening entry"
        },
        {
            "account": {
                "accountNumber": 1210002
            },
            "amountInBaseCurrency": 1200,
            "text": "Opening entry"
        }
    ]
}

If everything goes well you will receive something like this:

{
    "booked": false,
    "date": "2018-01-01",
    "voucherId": 100,
    "voucherNumber": {
        "displayVoucherNumber": "OAE1",
        "prefix": "OAE",
        "voucherNumber": 1
    },
    "lines": [
        {
            "account": {
                "accountNumber": 13101,
                "name": "Office equipment",
                "self": "https://rest.reviso.com/accounts/13101"
            },
            "amountInBaseCurrency": 1884117,
            "text": "Opening entry",
            "entryNumber": 175
        },
        {
            "customer": {
                "customerNumber": 1,
                "name": "John Doe",
                "self": "https://rest.reviso.com/customers/1"
            },
            "amountInBaseCurrency": 4000,
            "text": "Opening entry",
            "entryNumber": 176
        },
        {
            "supplier": {
                "name": "Mario Rossi",
                "supplierNumber": 1,
                "self": "https://rest.reviso.com/suppliers/1"
            },
            "amountInBaseCurrency": -1842935,
            "text": "Opening entry",
            "entryNumber": 177
        },
        {
            "account": {
                "accountNumber": 1210002,
                "name": "Sales costs",
                "self": "https://rest.reviso.com/accounts/1210002"
            },
            "amountInBaseCurrency": 1200,
            "text": "Opening entry",
            "entryNumber": 178
        }
    ],
    "self": "https://rest.reviso.com/opening-balances/drafts/100"
}

Please note how voucherId, voucherNumber and all the entryNumbers have been generated automatically.

Update a draft Opening Balance

PUT /opening-balances/drafts/:voucherId

It is also possible to update an existing draft Opening Balance. You can, for example, edit, remove or add lines by issuing a PUT request on the opening balance location.

Delete a draft Opening Balance

DELETE /opening-balances/drafts/:voucherId

You can delete a draft opening balance as well, by making a DELETE request to the same resource location.

Book a draft Opening Balance

Booking is also enabled throught REST APIs. To book an existing draft opening balance make a POST request containing voucherId and date.

POST /opening-balances/booked

{
    "date": "2018-01-01",
    "voucherId": 100
}

Get Opening Balances

There are a couple of ways to retrieve all the registered Opening Balances in Reviso.

Get all

GET /opening-balances

Get all opening balances, both drafts and booked.

Get all drafts

GET /opening-balances/drafts

Get all drafts opening balances.

Get a single draft

GET /opening-balances/:voucherId

Get a specific draft opening balance.

Get all booked

GET /opening-balances/booked

Get all booked opening balances.

Get a single booked

GET /opening-balances/booked/:voucherId

Get a specific booked opening balance.

For more info refer to the API docs or contact us at api@reviso.com.

Leave a reply

Your email address will not be published. Required fields are marked *