|
1 | 1 | const Ebay = require('../src/index');
|
2 | 2 | let access_token = "";
|
3 | 3 | 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----', |
6 | 6 | body: {
|
7 | 7 | grant_type: "client_credentials",
|
8 | 8 | scope: 'https://api.ebay.com/oauth/api_scope'
|
9 | 9 |
|
10 | 10 | }
|
11 | 11 | });
|
12 | 12 |
|
| 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 |
13 | 25 | // Getting access token and calling getItemByLegacyId method.
|
14 | 26 | ebay.getAccessToken()
|
15 | 27 | .then((data) => {
|
16 | 28 | 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" |
18 | 43 | }).then((data) => {
|
19 | 44 | if (!data) console.log(data);
|
20 | 45 | // Data is in format of JSON
|
|
0 commit comments