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

Cannot view offer from the api #5

Open
kingchun1991 opened this issue Oct 31, 2021 · 2 comments
Open

Cannot view offer from the api #5

kingchun1991 opened this issue Oct 31, 2021 · 2 comments

Comments

@kingchun1991
Copy link

"Resources": ["Offers.Listings.Price","Images.Primary.Medium", "ItemInfo.Title", "Offers.Listings.Promotions"],

{
  ASIN: 'B07GVRKCWP',
  DetailPageURL: 'https://www.amazon.com/dp/B07GVRKCW?XXXXXXXXXXXXXXXXX',
  Images: { Primary: { Medium: [Object] } },
  ItemInfo: {
    Title: {
      DisplayValue: 'SHW Electric Height Adjustable Standing Desk, 48 x 24 Inches, Light Cherry',
      Label: 'Title',
      Locale: 'en_US'
    }
  }
}
@Pigotz
Copy link
Owner

Pigotz commented Oct 31, 2021

Hi @kingchun1991 👋

Thanks for opening an issue 🙌

Could you provide some more details about the code? Without any snippet, it's difficult to understand what's going on wrong.

@kingchun1991
Copy link
Author

Hi @Pigotz

Here is my code:

import {
  GetItemsRequest,
  SearchItemsRequest,
  PartnerType,
  Host,
  Region,
} from "paapi5-typescript-sdk";

export const AMAZON_ACCESS_KEY: string = process.env.AMAZON_ACCESS_KEY || "";
export const AMAZON_SECRET_KEY: string = process.env.AMAZON_SECRET_KEY || "";
export const AMAZON_TAG: string = process.env.AMAZON_TAG || "";

export default async function searchById(id: string) {
  // await sleep(5000);
  const request = new GetItemsRequest(
    {
      Condition: "New",
      ItemIds: [id],
      Resources: [
        "Offers.Listings.Price",
        "Images.Primary.Medium",
        "ItemInfo.Title",
      ],
      Merchant: "Amazon",
    },
    AMAZON_TAG,
    PartnerType.ASSOCIATES,
    AMAZON_ACCESS_KEY,
    AMAZON_SECRET_KEY,
    Host.UNITED_STATES,
    Region.UNITED_STATES
  );
  return request.send();
}

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