json - Shopify Python API Request ISO 8601 Fomat
The Shopify API reference says:
Show products last updated after date (format: 2014-04-25T16:15:47-04:00)
If I have a datetime object when making an API call, do I need to convert the datetime to a string of ISO 8601 format prior to making the request?
i.e. do I need to do this?
min_date = timezone.now() shopify.Product.count(created_at_min = str(min_data.isoformat()))
My request would look like this then:
Versus this (if I pass the unformatted datetime object in):
(If so, why doesn't the Shopify Python API handle this conversion automatically, seems kind of silly?)
(From a response to my issue on the Shopify Python repo): The Shopify API actually does accept several date formats, but it's always safest to use the format that is documented in the API documentation (ISO 8601), as this is guaranteed to continue working in the future.
The current Shopify Python module does not currently handle date formatting, because the bulk of the functionality of the library is for wrapping HTTP requests using pyactiveresource - it is largely a port of https://github.com/shopify/shopify_api (https://github.com/shopify/shopify_api) and hasn't been extended to do this.
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.