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

Unable to retrieve warehouse locations along with inventory #280

Open
sanatg opened this issue Jul 11, 2024 · 2 comments
Open

Unable to retrieve warehouse locations along with inventory #280

sanatg opened this issue Jul 11, 2024 · 2 comments

Comments

@sanatg
Copy link

sanatg commented Jul 11, 2024

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!

@amz-tools
Copy link
Owner

@sanatg This should be included in the report GET_LEDGER_DETAIL_VIEW_DATA.

@sanatg
Copy link
Author

sanatg commented Sep 18, 2024

I tried to query it, this information isnt present their aswell

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

2 participants