Skip to content

Get Order Metrics Interval Issue #407

Answered by denisneuf
sktong asked this question in Q&A
Discussion options

You must be logged in to vote

the api takes the interval as a tuple:

def get_order_metrics(self, interval: tuple, granularity: Granularity, granularityTimeZone: str = None, **kwargs) -> ApiResponse:

and later will process it as required in your example:

    kwargs.update({
        **'interval': '--'.join([self._create_datetime_stamp(_interval) for _interval in interval]),**
        'granularity': granularity.value,
    })

so your code should be:

from sp_api.api import Sales
from sp_api.base import Granularity
res = Sales(credentials=credentials).get_order_metrics(
interval=("2021-02-20T00:00:00+08:00", "2022-02-20T00:00:00+08:00"),
granularity = Granularity.DAY)

Let me know if it works for you, in my end it gets the…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sktong
Comment options

Answer selected by saleweaver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants