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

If-Modified-Since could be string rather than time #145

Open
untoldone opened this issue Mar 3, 2019 · 0 comments
Open

If-Modified-Since could be string rather than time #145

untoldone opened this issue Mar 3, 2019 · 0 comments

Comments

@untoldone
Copy link

The current API calls excludes milliseconds while using the ModifiedAfter option. This is important as the Xero APIs return milliseconds in their UpdatedDateUTC fields (at least they do in the invoices APIs) e.g. "2019-03-01T09:00:31.597". The net result, is I can't hand back the most recent UpdatedDateUTC to get_invoices and expect the current item I'm looking at to have been excluded from the response.

As I understand it, most HTTP servers assume this header is a string and not at exact representation of time (the server compares the strings rather than parsing dates and comparing dates).

Code in question is

headers['If-Modified-Since'] = params.delete(:ModifiedAfter).utc.strftime("%Y-%m-%dT%H:%M:%S") if params[:ModifiedAfter]

....

Having dug in more, I noticed that the Xero API itself expects a specific date format that doesn't allow milliseconds (which is kind of unfortunate) ... I've decided to add a little bit of code to always round to the next second in my own project

While this isn't a bug I guess, it is something probably worth documenting in the wiki for xero-gateway as this doesn't match how most other APIs/ servers treat If-Modified-Since

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

1 participant