Closed ilyasProgrammer closed 2 years ago
At least one of ShipmentStatusList and ShipmentIdList must be provided.
last_updated_after = (datetime.utcnow() - timedelta(days=10))
res = FulfillmentInbound(marketplace=Marketplaces.DE).get_shipments(
QueryType='DATE_RANGE',
LastUpdatedAfter=last_updated_after.isoformat(),
LastUpdatedBefore=datetime.utcnow().isoformat(),
ShipmentStatusList=','.join([
'WORKING', 'SHIPPED', 'RECEIVING',
'CANCELLED', 'DELETED',
'CLOSED', 'ERROR', 'IN_TRANSIT',
'DELIVERED',
'CHECKED_IN'
]))
You can load all shipments like:
@throttle_retry()
@load_all_pages(extras=dict(QueryType='NEXT_TOKEN'))
def load_all_shipments(**kwargs):
return FulfillmentInbound().get_shipments(**kwargs)
def run():
for page in load_all_shipments(
QueryType='DATE_RANGE',
LastUpdatedAfter=(datetime.utcnow() - timedelta(days=10)).isoformat(),
LastUpdatedBefore=datetime.utcnow().isoformat(),
ShipmentStatusList=','.join([
'WORKING', 'SHIPPED', 'RECEIVING',
'CANCELLED', 'DELETED',
'CLOSED', 'ERROR', 'IN_TRANSIT',
'DELIVERED',
'CHECKED_IN'
])):
print(page)
I'm always happy to help, but please ask questions in discussions, or join the slack channel I've set up for questions. Thanks!
Should you wonder why some shipments are missing, please give this issue a thumbs up: https://github.com/amzn/selling-partner-api-models/issues/2063
Hi. Im struggling with inbound shipments. When i trying to get it like this:
inbound_api = FulfillmentInbound(Marketplaces[mp.code], refresh_token=mp.api_refresh_token) inbound_api.get_shipments(QueryType='DATE_RANGE', LastUpdatedAfter="2021-11-01T00:00:00.001Z", LastUpdatedBefore="2021-12-15T00:00:00.001Z")
im getting error:
{SellingApiBadRequestException}[{'code': 'InvalidInput', 'message': 'At least one of ShipmentStatusList and ShipmentIdList must be provided', 'details': ''}]
Also i tried to get it using QueryType='SHIPMENT' and providing ShipmentStatusList. As result always get empty data in response. I've tried all statuses ['WORKING', 'SHIPPED', 'IN_TRANSIT', 'DELIVERED', 'CHECKED_IN', 'RECEIVING', 'CLOSED', 'CANCELLED', 'DELETED', 'ERROR']