Mina produkter
Hjälp
johankarlstromer
CONTRIBUTOR *

Voucher and VoucherRows updates

av johankarlstromer

Hi

 

I have a question about the endpoints voucher/get-vouchers and voucher/get-voucherrows and how they are coupled together.

Lets say something changes on a voucher 2024-10-15 and i request voucher/get-vouchers?date=2024-10-15 I will get that voucher. Will I in a corresponding request from the rows endpoint voucher/get-voucherrows?date=2024-10-15 get all rows belonging to that voucher?

And the other way around, if a row changes on 2024-10-15 will I get the parent voucher if I request voucher/get-vouchers?date=2024-10-15?

5 SVAR 5
Godkänd lösning
Nick Perii
VISMA

av Nick Perii

Hello, 

 

The api/voucher/get-vouchers and api/voucher/get-voucherrows API endpoints both use the UpdatedOn value from the voucher header to retrieve the vouchers and voucher rows updated since the date specified as parameter in the request.  

So if you call both these endpoints with the same date you should get the vouchers and the voucher rows that were created/changed since that date.

BjornGavefeldt
CONTRIBUTOR *

av BjornGavefeldt

I'm not sure how the API works specifically here - but - the voucher entity and the voucherrow entity both have their own bookingdate fields. I'm not sure if they can be set differently in the UI of Visma, but if you can do that i would imagine the API simply provides you the data you ask for based on the values of those.

 

Meaning there likely isn't any link between them when you fetch data.

 

There are quite a few filtering options these endpoints could benefit from such as which company the rows belong to, which voucher they belong to (probably what you're really after here?) or even the values in o1-o8 just to name a few.

johankarlstromer
CONTRIBUTOR *

av johankarlstromer (Uppdaterad ‎16-10-2024 16:54 av johankarlstromer )

What I really want to do is to fetch all voucherrows that has been updated/inserted since a specific date and when I do this I want to get a few properties from the voucher at the same time. So I thought if I just run the two requests below I could then just join the result together. But if the parent voucher is not "updated" when the row is updated my approach wouldn't work.


voucher/get-voucherrows?date=2024-10-15

voucher/get-vouchers?date=2024-10-15

I stumbled on a case where some rows doesn't have the same bookDate as the voucher. And in this case it looks lite the voucher was updated when rowNo 38 was altered. But I don't know if this always is the case

 

// Voucher
{
    "businessUnit": "6228",
    "serie": "BF6228",
    "vouNo": 2,
    "voucherDate": "2021-08-06T00:00:00",
    "updatedOn": "2021-08-06T17:11:16.45",
    "yeaNo": 4,
    "period": 8
}

// Voucher Row with same bookdate
{
    "businessUnit": "6228",
    "vouNo": 2,
    "account": "1945",
    "amount": 137257.82000000,
    "foramount": 137257.82000000,
    "altered": 2,
    "bookDate": "2021-08-06T00:00:00",
    "serie": "BF6228",
    "rowNo": 38,
    "year": 4,
    "period": 8
}

// All other voucher rows on the same voucher
{
    "businessUnit": "6228",
    "vouNo": 2,
    "account": "1110",
    "amount": 218204281.00000000,
    "foramount": 218204281.00000000,
    "altered": 0,
    "bookDate": "2021-06-01T00:00:00",
    "serie": "BF6228",
    "rowNo": 0,
    "year": 4,
    "period": 6
}

 

 

BjornGavefeldt
CONTRIBUTOR *

To the best of my knowledge, these endpoints all operate on the booking date and not when they were actually created/updated.

 

Support for that is supposed to be coming soon from what we were told recently when talking about a integration we have. I don't know when or if it's going to be available to everyone. I could also be misinformed on exactly what is coming as it was in regards to being able to see anything that is new and ignore anything unchanged basically. which might be closely tied to what you're looking for here?

johankarlstromer
CONTRIBUTOR *

A while back I got a response from a Control edge developer saying: "Get voucher by date (one date) returns the vouchers updated/created  after the specified date- Our suggestion is to use this endpoint to get the delta (difference)" so when you just use the parameter "date" you should get new/updated.

Få uppdateringar på det här inlägget i din inkorg

Klicka på de tre prickarna till höger i inlägget/artikeln och välj Prenumerera.

Läs mer om prenumeration här