softwerkab / fortnox-csharp-api-sdk

.NET SDK for Fortnox API.
MIT License
52 stars 64 forks source link

Synchronizing data to partner application #200

Closed OliverDolan closed 2 years ago

OliverDolan commented 2 years ago

Hey, this is great to see a c# SDK. 😍

I just had some general questions about how best to architect and synchronise data from fortnox into an application we want to partner up with fortnox.

The main use cases right now is

  1. To allow fortnox users to synchronize their suppliers and contracts to our system by providing there api credentials

I was wondering around recommendations on how to sync the data on a regular basis, obviously as real time as possible is preferred.

Questions I am wondering on would be:

  1. Is there a webhook type of approach or do we need to poll for the data?
  2. If having to poll, what would be the most efficient way to poll for the data, is time/date based filtering the best approach using something like a cron job for new details?

Thanks for any guidance here, and if this is the wrong place to ask happy to be pointed elsewhere :)

richardrandak commented 2 years ago

Hello, and welcome! If you need official help, you should try Fortnox support. They are paid to help you :) This SDK is no longer supported by Fortnox, so it is maintained mainly by me. I can't promise to help, although I am trying to.

Answers: 1) Yes there are web-hooks - https://developer.fortnox.se/general/websockets/ However, this SDK does not support them at the moment. You can try the "rival" SDK instead, which supports them - https://github.com/zenta-ab/fortnox.NET

2) Most of the endpoints supports "LastModified" parameter to retrieve only latest (created or edited) entities. You can also set the max page size (500) to reduce number of requests. So lets say, every day, get entities with LastModified set to a time of your last execution. Note, that the date should be converted into the server (swedish) time zone, otherwise weird things can happen (talking from my own experience) :) ..better name for this parameter should be "modified since".