2
2
3
3
Ebay API Client for node js.
4
4
5
+ The intent is to simplify the request process by handling the tedious logic. It's a thin wrapper around eBay Api.
5
6
6
7
[ ![ npm version] ( https://badge.fury.io/js/ebay-node-api.svg )] ( https://badge.fury.io/js/ebay-node-api )
7
8
[ ![ Build Status] ( https://travis-ci.org/ajay2507/ebay-node-api.svg?branch=master )] ( https://travis-ci.org/ajay2507/ebay-node-api )
8
9
9
- # Installing
10
+
11
+ ## Table of Contents
12
+
13
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
14
+
15
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
16
+
17
+ * [ Installation] ( #installation )
18
+ * [ Usage] ( #usage )
19
+ * [ Examples] ( #examples )
20
+ * [ Getting Access Token] ( #getaccesstoken )
21
+ * [ Fetch Items By Keyword] ( #fetchitemsbykeyword )
22
+ * [ Get All Categories] ( #getallcategories )
23
+ * [ Get Items By Category] ( #getitemsbycategory )
24
+ * [ Get Single Item] ( #getitem )
25
+ * [ Get Item By Legacy Id] ( #getitembylegacyid )
26
+ * [ Get Items By Group Id] ( #getitemsbygroupid )
27
+ * [ Test] ( #test )
28
+ * [ Issues] ( #issues )
29
+ * [ LICENSE] ( #license )
30
+
31
+
32
+
33
+ ## Installation
10
34
11
35
``` shell
12
36
npm install ebay-node-api
@@ -24,7 +48,7 @@ let ebay = new eBay({
24
48
```
25
49
Creates a new ` Ebay ` instance.
26
50
27
- ### How to get clientId :
51
+ ### Getting Client ID :
28
52
29
53
Join eBay developers program.
30
54
Register your app here https://go.developer.ebay.com/quick-start-guide .
@@ -35,7 +59,27 @@ Register your app here https://go.developer.ebay.com/quick-start-guide.
35
59
- ` limit ` - optional(` Number ` ) - fetch items functionality - Number that limits the number of data you need in response.
36
60
- ` details ` - optional(` Boolean ` ) - Get User Details functionality - true, if you need details about the user.
37
61
38
- #### Example
62
+ ## Example
63
+
64
+ ## GetAccessToken
65
+
66
+ ``` javascript
67
+ const Ebay = require (' ../src/index' );
68
+
69
+ let ebay = new Ebay ({
70
+ clientID: " --Client Id----" ,
71
+ clientSecret: ' -- Client Secret --' ,
72
+ body: {
73
+ grant_type: " client_credentials"
74
+ }
75
+ });
76
+ ebay .getAccessToken ().then ((data ) => {
77
+ console .log (data); // data.access_token
78
+ }, (error ) => {
79
+ console .log (error);
80
+ });
81
+ ```
82
+
39
83
## FetchItemsByKeyword
40
84
``` javascript
41
85
const Ebay = require (" ebay-node-api" );
@@ -51,13 +95,90 @@ ebay.findItemsByKeywords("iphone").then((data) => {
51
95
});
52
96
```
53
97
54
- ## How do I run the tests?
98
+ ## GetAllCategories
99
+ ``` javascript
100
+ const Ebay = require (' ../src/index' );
101
+
102
+ let ebay = new Ebay ({
103
+ clientID: " -- Client App id ----" ,
104
+ details: " childCategories" // optional parameter
105
+ });
106
+
107
+ ebay .getAllCategories ().then ((data ) => {
108
+ console .log (data); // extract data.CategoryArray
109
+ }, (error ) => {
110
+ console .log (error);
111
+ })
112
+ ```
113
+ ## GetItemsByCategory
114
+ ``` javascript
115
+ const Ebay = require (' ../src/index' );
116
+
117
+ let ebay = new Ebay ({
118
+ clientID: " -- Client APP ID ----" ,
119
+ limit: 6
120
+ });
121
+ ebay .findItemsByCategory (10181 ).then ((data ) => {
122
+ console .log (data);
123
+ }, (error ) => {
124
+ console .log (error);
125
+ });
126
+ ```
127
+
128
+ ## GetItem
129
+ ``` javascript
130
+ // Get access token and pass it to this method
131
+ ebay .getAccessToken ()
132
+ .then ((data ) => {
133
+ ebay .getItem (' v1|202117468662|0' ).then ((data ) => {
134
+ console .log (data);
135
+ // Data is in format of JSON
136
+ // To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
137
+ })
138
+ });
139
+ ```
140
+
141
+ ## GetItemByLegacyId
142
+ ``` javascript
143
+ ebay .getAccessToken ()
144
+ .then ((data ) => {
145
+ ebay .getItemByLegacyId ({
146
+ " legacyItemId" : 2628001 // Get Item Details Using a Legacy ID
147
+ " legacyVariationSku" : " V-00031-WHM" // default null
148
+ }).then ((data ) => {
149
+ if (! data) console .log (data);
150
+ // Data is in format of JSON
151
+ // To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
152
+ });
153
+ });
154
+ ```
155
+
156
+
157
+ ## GetItemsByGroupId
158
+ ``` javascript
159
+ ebay .getAccessToken ()
160
+ .then ((data ) => {
161
+ ebay .getItemByItemGroup (" 151915076499" ).then ((data ) => {
162
+ // Data is in format of JSON
163
+ // To check the format of Data, Go to this url (https://jsonblob.com/56cbea67-30b8-11e8-953c-5d1886dcf4a0)
164
+ console .log (data)
165
+ }, (error ) => {
166
+ console .log (error);
167
+ });
168
+ });
169
+ ```
170
+
171
+ ## Test
55
172
All test files are present inside test folder. You can run using
56
173
57
174
``` javascript
58
175
npm run test
59
176
```
177
+ ## Issues:
178
+ If you are facing any issues, you can create the issues [ here] ( https://github.com/ajay2507/ebay-node-api/issues ) .
60
179
180
+ ## License:
181
+ MIT.
61
182
62
183
## Examples:
63
184
I have mentioned the examples here
0 commit comments