SendRegning

Flow of general ledger (beta users only)


Authentication

To authenticate, use basic auth.

Choose account (originator)

A user in SendRegning may have access to several accounts.

An account will be referred to as an originator for the rest of the document.

To choose an originator, specify the Originator-Id header with the originator id as value for every request.

To fetch all originators for a user - do a GET request to /user/originators.

This results in the following JSON.

1
2
3
4
5
6
7
8
9
10
11
{
    "items": [
        {
            "id": 1,
            "name": "Some Name",
            "role": "OWNER",
            "loggedIn": true
        }
    ],
    "total": 1
}

Get settings

1
GET /generalledger/settings

Response

HTTP/1.1 200 OK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
    "salesLedger": [
        {
            "type": "EXCHANGE_FEE",
            "accountNo": 4344
        },
        {
            "type": "SALES",
            "accountNo": 3245
        },
        {
            "type": "CURRENCY_GAIN",
            "accountNo": 8060
        },
        {
            "type": "CURRENCY_LOSS",
            "accountNo": 8160
        },
        {
            "type": "DUNNING_FEE",
            "accountNo": 8052
        },
        {
            "type": "DUNNING_FEE_CANCELLATION",
            "accountNo": 7831
        },
        {
            "type": "INTEREST",
            "accountNo": 8051
        },
        {
            "type": "INTEREST_LOSS",
            "accountNo": 7831
        },
        {
            "type": "LOSS",
            "accountNo": 7830
        },
        {
            "type": "BANK",
            "accountNo": 1920
        }
    ],
    "salesLedgerAccountNo": 1502,
    "salesAccountPerProduct": true
}

Update settings

1
POST /generalledger/settings

Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
    "salesLedger": [
        {
            "type": "EXCHANGE_FEE",
            "accountNo": 4344
        },
        {
            "type": "SALES",
            "accountNo": 3245
        },
        {
            "type": "CURRENCY_GAIN",
            "accountNo": 8060
        },
        {
            "type": "CURRENCY_LOSS",
            "accountNo": 8160
        },
        {
            "type": "DUNNING_FEE",
            "accountNo": 8052
        },
        {
            "type": "DUNNING_FEE_CANCELLATION",
            "accountNo": 7831
        },
        {
            "type": "INTEREST",
            "accountNo": 8051
        },
        {
            "type": "INTEREST_LOSS",
            "accountNo": 7831
        },
        {
            "type": "LOSS",
            "accountNo": 7830
        },
        {
            "type": "BANK",
            "accountNo": 1920
        }
    ],
    "salesLedgerAccountNo": 1502,
    "salesAccountPerProduct": true
}

Response

HTTP/1.1 200 OK

Create a series

1
POST /generalledger/series

Request

1
2
3
{
	"startDate": "2014-11-12 00:00"
}

Response

HTTP/1.1 200 OK

Get series

1
GET /generalledger/series

Response

HTTP/1.1 200 OK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[{
	"number": 1,
	"salesLedgerAccountNumber": 5000,
	"_links": {
		"unreadEntries": {
			"uri": "/generalledger/series/1/entries/new"
		},
		"confirmExported": {
			"uri": "/generalledger/series/1/exported"
		},
		"self": {
			"uri": "/generalledger/series/1"
		}
	}
}]

Get a series

1
GET /generalledger/series/{number}

Response

HTTP/1.1 200 OK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
	"number": 1,
	"salesLedgerAccountNumber": 5000,
	"_links": {
		"unreadEntries": {
			"uri": "/generalledger/series/1/entries/new"
		},
		"confirmExported": {
			"uri": "/generalledger/series/1/exported"
		},
		"self": {
			"uri": "/generalledger/series/1"
		}
	}
}

Get new entries for a series

1
GET /generalledger/series/{number}/entries/new

Response

HTTP/1.1 200 OK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[{
	"ledgerEntry": {
		"id": 1,
		"entryDate": "2014-01-01",
    "type": "INVOICE",
		"amounts": [{
			"vatRate": "0",
			"accountNo": 3000,
			"amount": "100,00"
		}, {
			"vatRate": "25",
			"accountNo": 3000,
			"amount": "125,00"
		}],
		"transactionId": 2014
	},
	"invoice": {
		"number": "1",
		"issueDate": "2014-01-01",
		"dueDate": "2014-01-14",
		"customerNo": "2",
		"name": "Test name",
		"address": {
			"address1": "addr1",
			"address2": "addr2",
			"zip": "0665",
			"city": "Oslo",
			"country": "NORGE"
		},
		"deliveryAddress": {
			"address": "delAddr1",
			"zip": "2040",
			"city": "Kløfta",
			"country": "NORGE"
		},
		"currency": {
			"code": "NOK",
			"exchangeRate": 7.237622,
			"currencyAmount": "230,00"
		},
		"KID": "0034246611",
		"tax": "25,00",
		"total": "225,00"
	}
}]

Mark entries as exported for series

1
POST /generalledger/series/{number}/exported

Request

1
[1, 5, 7]

Response

HTTP/1.1 200 OK