Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to format date. Not given in any of the valid formats. #288

Open
CaptainAweesome opened this issue Feb 23, 2024 · 1 comment
Open

Comments

@CaptainAweesome
Copy link

The FromDate and ToDate parameter options don't work and returns an Api Exception.

await orderConnector.FindAsync(new  OrderSearch()
{
FromDate = DateTime.Now,
ToDate = DateTime.Now
});
Fortnox.SDK.Exceptions.FortnoxApiException: Request failed: Failed to format date. Not given in any of the valid formats.
   at Fortnox.SDK.Connectors.Base.ErrorHandler.HandleErrorResponseAsync(HttpResponseMessage response)
   at Fortnox.SDK.Connectors.Base.BaseClient.SendAsync(HttpRequestMessage request)
   at Fortnox.SDK.Connectors.Base.BaseConnector.SendAsync(BaseRequest fortnoxRequest)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.GetSinglePage[T](SearchRequest`1 request)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.SendAsync[T](SearchRequest`1 request)
   at Fortnox.SDK.Connectors.Base.SearchableEntityConnector`3.BaseFind(BaseSearch searchSettings)
   at Fortnox.SDK.Connectors.OrderConnector.FindAsync(OrderSearch searchSettings)

Reply from Fortnox Support:
Currently used url and parameters: 3/orders?fromdate=2024-01-01%2011%3A23%3A38&todate=2024-03-01%2011%3A23%3A38&page=1

Using 3/orders/?fromdate=2024-01-01&todate=2024-03-01&page=1 the error message will disappear.

Version 4.3.15 of Fortnox.NET.SDK

@adamelfstrom
Copy link
Collaborator

If you use dates without a timestamp (as shown in the second url) there should be no errors.

So, the following example should be working.
FromDate = new DateTime(2024, 1, 1)

Do you need to use timestamps in the search?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants