Bookkeeping
Before bookkeeping entries or entry drafts can be created using the API methods, the broker company must do a setup and prepare the bookkeeping entry definitions. Then the entry definition can be fetched by the Get entry definition API method. Depending on the entry definition, an entry or entry draft can then be created using the Create entry and Create entry draft API methods.
Settings for API bookkeeping entry definitions in Core
Bookkeeping entries and entry drafts (green) created through the API or by Core users in Core
Get entry definition
This method will find and return the entry definition for the selected accountingCostType, if it is defined for the authenticated user.
GET /flow/api/Integrations/Bookkeeping/AccountingCostTypes/{accountingCostType}
Parameters
accountingCostType: The accounting cost type - will be provided by Visma. It will depend on the service for which you will be adding the bookkeeping entries or entry drafts.
Sample response
{
// The entry definition id
"Id": 17,
// The entry definition name
"Name": "Bilagstype navn",
// If true, only entry drafts for this entry definition are allowed to be created via the bookkeeping API. If false, only "bokført" entries for this entry definition are allowed to be created via the bookkeeping API
"IsDraft": false,
// If true, each order should only create one entry/entry draft
"MergeOrderLinesToOneEntry": true
}
Create entry draft
This method can only be used if the result of Get entry definition has IsDraft set to true. The method will create a new bookkeeping entry draft for the selected amount on the selected case. Created entry draft can be approved and converted to “bokført” entry by the broker or responsible on the case.
POST /flow/api/Integrations/Bookkeeping/Cases/{caseId}/EntryDrafts
Parameters
caseId: The id of the case to which you want to add the bookkeeping entry
Body
{
// The entry definition id (from Get entry definition)
"EntryDefinitionId": 17,
// The entry/entry draft amount
"Amount": 1544.95,
// The entry/entry draft Description
"Description": "Description 1",
//The entry/entry draft Note
"Note": "Note"
}
Sample response
{
"Id": 161,
"CaseId": 1894,
"EntryDefinitionId": 17,
"VAT": 0.25,
"CreatedById": 215,
"RegisteredDate": "2022-01-31T16:42:18.3944589+01:00",
"CreditAccountId": 7,
"DebitAccountId": 1,
"Amount": 1234.95,
"Description": "Description 1",
"Source": "IntegrationsBookkeepingApi",
"EncounterId": 0
}
Create entry
This method can only be used if the result of Get entry definition has IsDraft set to false. The method will create a new bookkeeping entry for the selected amount on the selected case. The created entry will be created as “bokført” and cannot (easily) be changed later. The broker or anyone else will not be required to do anything more with this entry.
POST /flow/api/Integrations/Bookkeeping/Cases/{caseId}/Entries
Parameters
caseId: The id of the case to which you want to add the bookkeeping entry
Body
{
// The entry definition id (from Get entry definition)
"EntryDefinitionId": 17,
// The entry/entry draft amount
"Amount": 1544.95,
// The entry/entry draft Description
"Description": "Description",
//The entry/entry draft Note
"Note": "Note",
// The entry date (not required for entry drafts)
"EntryDate": "2022-02-01T00:00:00+02:00",
}
Sample response:
{
"Id": 145,
"CaseId": 1894,
"EntryNumber": 145,
"VAT": 0.25,
"CreditAccountId": 7,
"CreditAccountNumber": 3049,
"DebitAccountId": 1,
"DebitAccountNumber": 1510,
"DebitLedgerNumber": "122100091",
"EntryDate": "2022-02-01T00:00:00+02:00",
"RegisteredDate": "2022-01-31T16:47:12.8363753+01:00",
"Description": "Description",
"CreatedById": 215,
"Amount": 1544.95,
"EntrySource": "IntegrationsBookkeepingApi"
}
Seller and Buyer costs
Costs are usually made by the broker companies themselves. These costs will automatically be made into an entry or draft if the cost is not optional and the case reaches a pre-defined status. An integrator should get all costs on a case, find the one they are looking for and run a patch to update its values accordingly. If the accounting already has an entry or draft, these should be updated accordingly. Note: In case of setting up automated invoicing between the broker company and the integrator, see Invoicing.
Get all costs for a given case
This method returns all buyer costs on a case
GET /flow/api/Conditions/Cases/{id}/Costs/{type}
Parameters
- caseId: The id of the case to which you want to add the bookkeeping entry
- type: Either Buyer or Seller, depending on which costs to retrieve
Sample response
{
"DisplayWarning": false,
"Editable": true,
"IsAccounted": true,
"Optional": true,
"Selected": false,
"EntryDraftId": 145,
"Id": 88808,
"Amount": 4500,
"Comment": "Test of cost",
"Deleted": false,
"EntryDefinitionId": 2219,
"IsEditable": true,
"IsHidden": false,
"IsStandard": true,
"IsOptional": true,
"StandardCostStatusType": "Draft",
"StatusType": "Draft",
"AccountingType": "OnCreate",
"StandardCostPostStatusType": "OnCreate",
"SettlementStatementGroup": "DrawnInSettlement",
"VAT": 0
}
Update an existing cost This endpoint patches the cost for the specified case.
PATCH /flow/api/Conditions/Properties/{id}/Costs/{condtionCostId}/{type}
Parameters
caseId: The id of the case to which you want to update a cost conditionCostId: The Id of the cost, as provided in the GET mentioned earlier type: Either ‘Buyer’ or ‘Seller’, depending on which costs to retrieve
Body
{
"IsOptional": false
}
Sample response
{
"DisplayWarning": false,
"Editable": true,
"IsAccounted": true,
"Optional": true,
"Selected": false,
"EntryDraftId": 145,
"Id": 88808,
"Amount": 4500,
"Comment": "Test of cost",
"Deleted": false,
"EntryDefinitionId": 2219,
"IsEditable": true,
"IsHidden": false,
"IsStandard": true,
"IsOptional": false,
"StandardCostStatusType": "Draft",
"StatusType": "Draft",
"AccountingType": "OnCreate",
"StandardCostPostStatusType": "OnCreate",
"SettlementStatementGroup": "DrawnInSettlement",
"VAT": 0
}