Internal Server Error 500 | GET request using itemId
I'm using node js and express to make a GET request to this endpoint: https://api.ebay.com/buy/browse/v1/item_summary/search
const itemId = req.params.itemId;
console.log(itemId);
try {
headers: {
'Authorization': `Bearer ${process.env.EBAY_AUTH_TOKEN}`,
'Content-Type': 'application/json',
'X-EBAY-C-MARKETPLACE-ID': 'EBAY-US',
'X-EBAY-C-ENDUSERCTX': 'affiliateCampaignId="5********3"'
}
});
const item = response.data;
res.json(item);
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Error retrieving item details' });
}
});
I checked if the itemId is defined, and I successfully logged it to the console. It was retrieved by making a get request to the browse api using a keyword search:
Here is the URL I'm testing in Postman. Is this the correct way to format the URL?
Here is the error that was sent in the response:
response: {
status: 500,
statusText: 'Internal Server Error',
headers: AxiosHeaders {
'x-ebay-c-request-id': 'ri=cNNUiSX0VBFp,rci=f7cf917d90cee161',
'x-ebay-svc-ep-cookielet': '321=0001679275438025',
rlogid: 't6ovriddvn9%3Ftiliusmbgwj%284ctch*w%60ut3542-186fc9dafc9-0x2e6',
'x-ebay-c-version': '1.0.0',
'x-frame-options': 'SAMEORIGIN',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'x-ebay-svc-tracking-data': '<a>ul=en-US&uc=1&eprlogid=t6ovriddvn9%253Ftiliusmbgwj%25284ctch*w%2560ut3542-186fc9dafc9-0x2e6&hrc=500&**bleep**=0&nqt=AA**&!_epec=7,6,8&nqc=AA**&epcalenv=</a>',
'accept-ch': 'sec-ch-ua-model,sec-ch-ua-platform-version,sec-ch-ua-full-version',
'set-cookie': [Array],
'cache-control': 'private',
pragma: 'no-cache',
date: 'Mon, 20 Mar 2023 01:23:57 GMT',
server: 'ebay-proxy-server',
'x-envoy-upstream-service-time': '20',
'x-ebay-pop-id': 'UFES2-RNOAZ03-api',
connection: 'close',
'transfer-encoding': 'chunked'
},
response: {
status: 500,
statusText: 'Internal Server Error',
headers: AxiosHeaders {
'x-ebay-c-request-id': 'ri=cNNUiSX0VBFp,rci=f7cf917d90cee161',
'x-ebay-svc-ep-cookielet': '321=0001679275438025',
rlogid: 't6ovriddvn9%3Ftiliusmbgwj%284ctch*w%60ut3542-186fc9dafc9-0x2e6',
'x-ebay-c-version': '1.0.0',
'x-frame-options': 'SAMEORIGIN',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'x-ebay-svc-tracking-data': '<a>ul=en-US&uc=1&eprlogid=t6ovriddvn9%253Ftiliusmbgwj%25284ctch*w%2560ut3542-186fc9dafc9-0x2e6&hrc=500&**bleep**=0&nqt=AA**&!_epec=7,6,8&nqc=AA**&epcalenv=</a>',
'accept-ch': 'sec-ch-ua-model,sec-ch-ua-platform-version,sec-ch-ua-full-version',
'set-cookie': [Array],
'cache-control': 'private',
pragma: 'no-cache',
date: 'Mon, 20 Mar 2023 01:23:57 GMT',
server: 'ebay-proxy-server',
'x-envoy-upstream-service-time': '20',
'x-ebay-pop-id': 'UFES2-RNOAZ03-api',
connection: 'close',
'transfer-encoding': 'chunked'
},
rehomm_0
Posted 3 years ago · Edited 3 years ago·Last reply 3 years ago
2 comments
five_notch_trading_post
·3 years agothis URL works
https://api.ebay.com/buy/browse/v1/item/v1%7C373817615913%7C642852859250
(my client encoded the | )
This likely should work as well:
https://api.ebay.com/buy/browse/v1/item/v1|373817615913|642852859250
https://api.ebay.com/buy/browse/v1/item_summary/search is for the browse search call
https://developer.ebay.com/api-docs/buy/browse/resources/item_summary/methods/search
For get item it shows the format:
https://api.ebay.com/buy/browse/v1/item/{item_id}?fieldgroups=string
fieldgroups being optional and {item_id} being the format you listed without the extra path stuff preceding it: v1|373817615913|642852859250
https://developer.ebay.com/api-docs/buy/browse/resources/item/methods/getItem
might want to add these headers as well:
Accept:application/json
Accept-Encoding:application/gzip
rehomm_0
OP3 years agoThanks!!
For some reason the response to my GET request did not like the vertical bars used in the itemId, but when i replaced them with '%7C' it worked.
Here is my solution: