cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API Help with my request

hello Everyone, new to APIs and working on something for a personal usecase. can someone help me with the code that I have generated to bring back all the luxury watches on Ebay. i am getting item_DF and other items as null when trying to fetch data. any help is highly appreciated.

 

library(httr)
library(jsonlite)

query <- "rolex|breitling|cartier|omega|Audemars Piguet|Patek Philippe|panerai|hublot"

url <- paste0("https://api.ebay.com/buy/browse/v1/item_summary/search?q=", URLencode(query), "&filter=listingFormat:{fixed_price}+condition:{new}+priceCurrency:{USD}&limit=10")

response <- GET(url,
add_headers(Authorization = "Bearer <I used my token here>",
"Content-Type" = "application/json",
"X-EBAY-C-MARKETPLACE-ID" = "EBAY",
"X-EBAY-C-ENDUSERCTX" = "contextualLocation=country=US"))

items <- content(response)$itemSummaries

item_data <- lapply(items, function(x) {
data.frame(brand = x$brand, model = x$title, condition = x$condition, location = x$location, price = x$price$value, currency = x$price$currency)
})

item_df <- do.call(rbind, item_data)

Message 1 of 2
latest reply
1 REPLY 1

API Help with my request

@muhapa-2029 

 

I don' recognize your library, and don't use the Browse API, so only marginal help here.

But hopefully, some of this will get you a little closer to your goal.

 

Reading through the Browse API options, these pages might help:

https://developer.ebay.com/api-docs/buy/browse/resources/methods

https://developer.ebay.com/api-docs/buy/static/ref-buy-browse-filters.html

 

Without a category, you'll get parts, ephemera, and unrelated items.

This is a visual representation of the query for your endpoint (you'll need to correctly encode it):

 

?q=URLencode( (rolex,breitling,cartier,omega,Audemars Piguet,Patek Philippe,panerai,hublot) )

&category_ids=31387

&filter=URLencode(listingFormat:FIXED_PRICE,conditions:NEW,priceCurrency:USD)

&limit=10

 

optional aspect

&aspect_filter=URLencode(categoryId:31387,Brand:{rolex|breitling|cartier|omega|Audemars Piguet|Patek Philippe|panerai|hublot})

 

"X-EBAY-C-MARKETPLACE-ID" = "EBAY"  "EBAY_US"

"X-EBAY-C-ENDUSERCTX" = "contextualLocation=URLencode(country=US)"

 

 

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 2 of 2
latest reply