Skip to content

Unable to retrieve warehouse locations along with inventory #280

@0xS4N4TG

Description

@0xS4N4TG

Hello,

I've been using the Amazon SP API to fetch inventory summaries, and previously, when using a PHP package, I was able to retrieve the warehouse locations associated with the inventory items. However, after reimplementing this functionality in Node.js using the amazon-sp-api package, I am unable to find the endpoint or method to retrieve the warehouse locations.

Here is a snippet of my current implementation:

async function fetchInventorySummaries(nextToken = null, allSummaries = []) {
  try {
    const query = {
      marketplaceIds: ["A21TJRUUN4KGV"],
      details: true,
      granularityType: "Marketplace",
      granularityId: "A21TJRUUN4KGV",
      nextToken: null
    };

    if (nextToken) {
      query.nextToken = nextToken;
    } else {
      query.nextToken = null;
    }

    const inventorySummaries = await spClient.callAPI({
      operation: "getInventorySummaries",
      endpoint: "fbaInventory",
      query: query
    });

    allSummaries.push(...(inventorySummaries.inventorySummaries as []));

    if (inventorySummaries.nextToken) {
      return await fetchInventorySummaries(inventorySummaries.nextToken, allSummaries);
    }

    return allSummaries;

  } catch (error) {
    throw new Error(`Failed to fetch inventory summaries: ${(error as any).message}`);
  }
}

Any guidance would be appreciated. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions