Skip to content

Commit

Permalink
update README, add example to write category into JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
BL committed Oct 28, 2018
1 parent 8793d71 commit 47b6f4a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ typings/

#IDE
.idea

#Temp Directory
temp/*
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ eBay.setApiKey('YOUR_KEY', 'YOUR_SECRET');
- Contributors can send their Pull Request to `development` branch.
- Kindly validate test cases & linting before opening new PR.

## Do you need an expert?
Are you finding a developer for your word class product? If yes, please contact here. [Submit your project request here.](https://goo.gl/forms/UofdG5GY5iHMoUWg2)
```
Originally by [Bhushankumar Lilapara](https://github.com/bhushankumarl) ([email protected]).
```

## Examples
### Application
#### Oauth Token
```
Expand Down
6 changes: 3 additions & 3 deletions examples/javaScript/commerce/taxonomy/getCategorySubtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ var categoryRequest = async function () {
return;
}

var categoryTreeId = 203;
var categoryTreeId = '0';
var data = {
category_id: '179623'
category_id: '34'
};
try {
var response = await eBay.taxonomy.getCategorySubtree(categoryTreeId, data);
console.log('response', response);
console.log('response', JSON.stringify(response));
} catch (error) {
console.log('error ', error);
return;
Expand Down
32 changes: 32 additions & 0 deletions examples/javaScript/commerce/taxonomy/getCategoryTreeToFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY';
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET';

var eBay = require('../../../../lib/eBay-node-client')(clientId, clientSecret);
var fse = require('fs-extra');

var categoryRequest = async function () {
try {
var token = await eBay.application.getOAuthToken({
grant_type: 'client_credentials',
scope: 'https://api.ebay.com/oauth/api_scope'
});
eBay.setToken(token.access_token);
} catch (error) {
console.log('error ', error);
return;
}

var categoryTreeId = '0';
try {
var response = await eBay.taxonomy.getCategoryTree(categoryTreeId);
console.log('response', JSON.stringify(response));
fse.writeFileSync('temp/response.json', JSON.stringify(response));
} catch (error) {
console.log('error ', error);
return;
}
};

categoryRequest();

0 comments on commit 47b6f4a

Please sign in to comment.