My Products
Help
Anonymous
Not applicable

How to get the latest invoice/adjustment on a given supplier?

by Anonymous

Hi,

 

I would like to use the API to make automated invoices/credit adjustments in Visma. As a preventive measure in this automation process I would like to obtain information about the latest invoices/credit adjustments (note that I write in plural) that has been posted in the accounting system.

 

Which endpoints are the best in order to do this? 

 

Thank you.

8 REPLIES 8
Anonymous
Not applicable

by Anonymous

Hi,

I changed toe condition to ">" as you proposed and it worked out very good.

However, what you said about filtering on the supplier was incorrect. 

It seems like you have to use the supplier endpoint, instead of the supplierInvoice endpoint. I do not know why it was placed there, but it was very hard to find.

 

At least it gives me the result I want. 

by Magnus Johnsen

Hi,

If you call the supplierInvoice endpoint with the parameters for createdDateTime or lastModifiedDateTime & conditions you should be able to do checks for this for the scenario you want.

The example and values for the parameters works for the "createdDateTime" & "createdDateTimeCondition" pair as well.

Depending on exactly what you might want to do, you might prefer one over the other.

Update the dateTime to when you last checked if you had any new values.

Example of usage with parameters

Query parameters:

  • lastModifiedDateTime=YYYY-MM-DD

As of today Filtering Parameters does not accept certain characters such as W-Z

These are the formats for Filtering

*2001-01-01

*2001-01-01 13:13:13

*2001-01-01 13:13:13.133

 

  • lastModifiedDateTimeCondition=Operator

Supported comparative operators for LastModifiedDateTime Conditions on filtering 

> - Greater than

< - Less than

<= - Less than or equal to

>= - Greater than or equal to

Anonymous
Not applicable

by Anonymous

I see. But how do I specify which supplier I am getting the range of invoices from? 

Anonymous
Not applicable

by Anonymous

Also, I am getting error messages whenever I specify the document type as Invoice.

I am using the supplierInvoice endpoint and I tried to get all of the invoices from First of February 2022. I used with the following URL and got response code 500: 

 

https://integration.visma.net/API/controller/api/v1/supplierInvoice?documentType=Invoice&lastModifie...

 

This was the response message: 

"VismaId: ee9a1f9c-2fde-4f82-9ab6-f92ed1c2c9b2. Conversion failed when converting date and/or time from character string."

 

by Magnus Johnsen

Hi,

It's currently not possible to filter on the supplier, it sounds like you can rework the current workflow to minimize the amounts of calls that you make but just getting all documents modified since the last time you checked and the work with the result set on your end.

the "lastModifiedDateTime" should be ">" not "Greater than".

Please try to correct this.

Anonymous
Not applicable

by Anonymous

Hi! I tried to use ">" on my query and it seems to work now. So that's great!

However, what you said about the supplier was not correct. You actually can filter invoices/Credit adjustments ect from the Supplier endpoint, and not the SupplierInvoice Endpoint. 

I am not sure it was placed there, but at least I got the desired result. 

Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

Yes, that is true, you can use both the Customer & the Supplier to find the documents related to each category, I forgot that that might have been a better solution for you. Great that you managed to find it and that your query works in the way you intended.

 

Depending on how your workflow is designed you can still use either customerInvoice/supplierInvoice to accomplish the same.

 

Please let us know if there is anything else you are wondering about. 

Anonymous
Not applicable

by Anonymous

Yess, thank you.

I appreciate the help!