hendt / ebay-api

eBay Node API in TypeScript for Node and Browser with RESTful and Traditional APIs. This library aims to implement all available eBay apis.
https://hendt.gitbook.io/ebay-api
MIT License
153 stars 41 forks source link

I'm not getting itemAffiliateWebUrl from eBay.buy.browse.search #133

Closed benbluehyve closed 1 year ago

benbluehyve commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

Code

const eBay = new eBayApi({
  appId: process.env.EBAY_APP_ID!,
  certId: process.env.EBAY_CERT_ID!,
  sandbox: false,
});

const result = await eBay.buy.browse.search({
  q: query,
  limit: 3,
});

Output

{
  "itemSummaries": [
    {
      "itemId": "v1|184097965661|0",
      "title": "2022 New RC Drone With 4K HD Dual Camera WiFi FPV Foldable Quadcopter +4 Battery",
      "leafCategoryIds": [
        "179697",
        "182186"
      ],
      "categories": [
        {
          "categoryId": "179697",
          "categoryName": "Camera Drones"
        },
        {
          "categoryId": "182186",
          "categoryName": "Other RC Model Vehicles & Kits"
        },
        {
          "categoryId": "2562",
          "categoryName": "Radio Control & Control Line"
        },
        {
          "categoryId": "220",
          "categoryName": "Toys & Hobbies"
        },
        {
          "categoryId": "625",
          "categoryName": "Cameras & Photo"
        },
        {
          "categoryId": "182181",
          "categoryName": "RC Model Vehicles & Kits"
        }
      ],
      "image": {
        "imageUrl": "https://i.ebayimg.com/thumbs/images/g/nQAAAOSwTdRik6ha/s-l225.jpg"
      },
      "price": {
        "value": "59.99",
        "currency": "USD"
      },
      "itemHref": "https://api.ebay.com/buy/browse/v1/item/v1%7C184097965661%7C0",
      "seller": {
        "username": "mayvillage",
        "feedbackPercentage": "98.8",
        "feedbackScore": 110382
      },
      "marketingPrice": {
        "originalPrice": {
          "value": "74.99",
          "currency": "USD"
        },
        "discountPercentage": "20",
        "discountAmount": {
          "value": "15.00",
          "currency": "USD"
        },
        "priceTreatment": "LIST_PRICE"
      },
      "condition": "New",
      "conditionId": "1000",
      "thumbnailImages": [
        {
          "imageUrl": "https://i.ebayimg.com/images/g/nQAAAOSwTdRik6ha/s-l1200.jpg"
        }
      ],
      "shippingOptions": [
        {
          "shippingCostType": "FIXED",
          "shippingCost": {
            "value": "0.00",
            "currency": "USD"
          },
          "minEstimatedDeliveryDate": "2022-12-19T08:00:00.000Z",
          "maxEstimatedDeliveryDate": "2022-12-21T08:00:00.000Z",
          "guaranteedDelivery": true
        }
      ],
      "buyingOptions": [
        "FIXED_PRICE",
        "BEST_OFFER"
      ],
      "itemWebUrl": "https://www.ebay.com/itm/184097965661?hash=item2add18065d:g:nQAAAOSwTdRik6ha&amdata=enc%3AAQAHAAAA4GlFY1WAnA%2FckAYALN0CRgPRjd9Myh1Obg6ByKRHJztMR%2BB3surlZyemsqh7kMLaugbJihvpZV9ExW%2FuOnjI6IZtrN2B4dbT%2FGDWkFFrwW6sxKnKosxQA02DJ0FIIRduxjHUV5dHkoUZTvjcL2sZxJYm2kYk57uDV1miuPWVRfMNjmMEKBLQTvmSmCre0yUnxtTaJ77bLWG%2BlcT3vZzptLoosb92SS2K2Fl%2Bt19zHHcY6nQQqYTEx8S1wjav%2Bel%2Ba7hRSQtegcM8j4wpGL0X11Tl3EE0U38NpaeJ5Bt8RhYT",
      "itemLocation": {
        "postalCode": "085**",
        "country": "US"
      },
      "additionalImages": [
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_2_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_3_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_4_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_5_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_6_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_7_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_8_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_9_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_10_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_11_0_1/225x225.jpg"
        },
        {
          "imageUrl": "https://origin-galleryplus.ebayimg.com/ws/web/184097965661_12_0_1/225x225.jpg"
        }
      ],
      "adultOnly": false,
      "legacyItemId": "184097965661",
      "availableCoupons": false,
      "itemCreationDate": "2019-12-25T07:14:44.000Z",
      "topRatedBuyingExperience": true,
      "priorityListing": true,
      "listingMarketplaceId": "EBAY_US"
    },
...

expected data

There should be another item like "itemAffiliateWebUrl": "https://www.ebay.com/itm/...."

Would you like to work on this issue?

dantio commented 1 year ago

The URL to the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the seller enables affiliate tracking for the item by including the X-EBAY-C-ENDUSERCTX request header in the method.

eBay.buy.browse.api({
  headers: {
      'X-EBAY-C-ENDUSERCTX': '...'
  }})
.search({
  q: query,
  limit: 3,
}).then((item) => {
    console.log(item)
})

Example: X-EBAY-C-ENDUSERCTX: affiliateCampaignId=,affiliateReferenceId=, contextualLocation=country=<2-digitCountryCode>,zip=, deviceId=

benbluehyve commented 1 year ago

thank you so much! it works!