Skip to content

Commit d0b820c

Browse files
committed
demo for getting item by legacy id
1 parent 7c4cfec commit d0b820c

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

demo/browseApi.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
11
const Ebay = require('../src/index');
22
let access_token = "";
33
let ebay = new Ebay({
4-
clientID: "Ajaykuma-nodeapi-PRD-bf1a91299-ed4deb45",
5-
clientSecret: 'PRD-f1a91299c206-f184-45e0-b068-f139',
4+
clientID: "--Client ID -----",
5+
clientSecret: '-- Client Secret----',
66
body: {
77
grant_type: "client_credentials",
88
scope: 'https://api.ebay.com/oauth/api_scope'
99

1010
}
1111
});
1212

13+
// Getting access token and calling getItem method.
14+
ebay.getAccessToken()
15+
.then((data) => {
16+
ebay.getItem('v1|202117468662|0').then((data) => {
17+
console.log(data);
18+
// Data is in format of JSON
19+
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
20+
})
21+
});
22+
23+
24+
// Reference ebay developer page https://developer.ebay.com/api-docs/buy/browse/resources/item/methods/getItemByLegacyId#_samples
1325
// Getting access token and calling getItemByLegacyId method.
1426
ebay.getAccessToken()
1527
.then((data) => {
1628
ebay.getItemByLegacyId({
17-
"legacyItemId": 2628001
29+
"legacyItemId": 2628001 // Get Item Details Using a Legacy ID
30+
}).then((data) => {
31+
if (!data) console.log(data);
32+
// Data is in format of JSON
33+
// To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
34+
});
35+
});
36+
37+
//Get Item Details Using a Legacy ID and SKU
38+
ebay.getAccessToken()
39+
.then((data) => {
40+
ebay.getItemByLegacyId({
41+
"legacyItemId": 2628001,
42+
"legacyVariationSku": "V-00031-WHM"
1843
}).then((data) => {
1944
if (!data) console.log(data);
2045
// Data is in format of JSON

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ Ebay.prototype = {
116116
let param = "legacy_item_id=" + legacyOptions.legacyItemId;
117117
param += legacyOptions.legacyVariationSku ? "&legacy_variation_sku=" + legacyOptions.legacyVariationSku : '';
118118
return makeRequest('api.ebay.com', `/buy/browse/v1/item/get_item_by_legacy_id?${param}`, 'GET', this.options.body, auth).then((result) => {
119-
console.log("Successsssssss");
120119
let resultJSON = JSON.parse(result);
121120
//this.setAccessToken(resultJSON);
122121
return resultJSON;

0 commit comments

Comments
 (0)