-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/development' into development
- Loading branch information
Showing
22 changed files
with
501 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
examples/typeScript | ||
test/ | ||
test/ | ||
examples/javaScript/sample/getMatchingProductAsyncAwait.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,41 @@ amazonMws.setApiKey(accessKey, accessSecret); | |
- Contributors can send their Pull Request to `development` branch. | ||
- Kindly validate test cases & linting before opening new PR. | ||
|
||
#### Success or Error StatusCode can be obtained directly using StatusCode property of response. It will give you same as what Amazon MWS provides. | ||
#### It is also sample of the error responses. | ||
``` | ||
{ | ||
Type:'Sender', | ||
Code:'InvalidRequestException', | ||
Message:'Invalid xxxxx: ', | ||
Headers: { | ||
'x-mws-quota-max': '', | ||
'x-mws-quota-remaining': '', | ||
'x-mws-quota-resetson': '', | ||
'x-mws-timestamp': '2018-09-05T06:13:00.276Z', | ||
'content-type': 'text/xml', | ||
'content-charset': '', | ||
'content-length': '', | ||
'content-md5': '', | ||
'date': '' | ||
}, | ||
StatusCode:400, | ||
RequestId: 'XXXXX-XXXXXX-XXXXX' | ||
} | ||
``` | ||
|
||
#### Additionally all api returns Throttling: Limits to how often you can submit requests | ||
Reference : http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_Throttling.html | ||
```json | ||
{ | ||
"x-mws-quota-max": "60.0", | ||
"x-mws-quota-remaining": "38.0", | ||
"x-mws-quota-resetson": "2017-12-08T08:21:00.000Z", | ||
"x-mws-timestamp": "2017-12-08T07:52:15.567Z" | ||
} | ||
``` | ||
Originally by [Bhushankumar Lilapara](https://github.com/bhushankumarl) ([email protected]). | ||
|
||
### Feeds | ||
|
||
#### Submit Feed | ||
|
@@ -300,7 +335,6 @@ amazonMws.setApiKey(accessKey, accessSecret); | |
}); | ||
``` | ||
|
||
|
||
### Orders | ||
|
||
#### List Orders | ||
|
@@ -432,15 +466,16 @@ amazonMws.setApiKey(accessKey, accessSecret); | |
}); | ||
``` | ||
|
||
### Sellers | ||
### Recommendations | ||
|
||
#### List Marketplace Participations | ||
#### Get Last Updated Time For Recommendations | ||
```js | ||
amazonMws.sellers.search({ | ||
'Version': '2011-07-01', | ||
'Action': 'ListMarketplaceParticipations', | ||
amazonMws.recommendations.searchFor({ | ||
'Version': '2013-04-01', | ||
'Action': 'GetLastUpdatedTimeForRecommendations', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN' | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
|
@@ -450,14 +485,17 @@ amazonMws.setApiKey(accessKey, accessSecret); | |
}); | ||
``` | ||
|
||
#### List Marketplace Participations By Next Token | ||
#### List Recommendations | ||
```js | ||
amazonMws.sellers.search({ | ||
'Version': '2011-07-01', | ||
'Action': 'ListMarketplaceParticipationsByNextToken', | ||
amazonMws.recommendations.searchFor({ | ||
'Version': '2013-04-01', | ||
'Action': 'ListRecommendations', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'NextToken': 'NEXT_TOKEN' | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1': 'QualitySet=Defect', | ||
'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.2': 'ListingStatus=Active', | ||
'CategoryQueryList.CategoryQuery.1.RecommendationCategory': 'ListingQuality' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
|
@@ -555,37 +593,99 @@ amazonMws.setApiKey(accessKey, accessSecret); | |
} | ||
``` | ||
|
||
#### Success or Error StatusCode can be obtained directly using StatusCode property of response. It will give you same as what Amazon MWS provides. | ||
#### It is also sample of the error responses. | ||
### Sellers | ||
|
||
#### List Marketplace Participations | ||
```js | ||
amazonMws.sellers.search({ | ||
'Version': '2011-07-01', | ||
'Action': 'ListMarketplaceParticipations', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
``` | ||
{ | ||
Type:'Sender', | ||
Code:'InvalidRequestException', | ||
Message:'Invalid xxxxx: ', | ||
Headers: { | ||
'x-mws-quota-max': '', | ||
'x-mws-quota-remaining': '', | ||
'x-mws-quota-resetson': '', | ||
'x-mws-timestamp': '2018-09-05T06:13:00.276Z', | ||
'content-type': 'text/xml', | ||
'content-charset': '', | ||
'content-length': '', | ||
'content-md5': '', | ||
'date': '' | ||
}, | ||
StatusCode:400, | ||
RequestId: 'XXXXX-XXXXXX-XXXXX' | ||
} | ||
|
||
#### List Marketplace Participations By Next Token | ||
```js | ||
amazonMws.sellers.search({ | ||
'Version': '2011-07-01', | ||
'Action': 'ListMarketplaceParticipationsByNextToken', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'NextToken': 'NEXT_TOKEN' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
``` | ||
|
||
#### Additionally all api returns Throttling: Limits to how often you can submit requests | ||
Reference : http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_Throttling.html | ||
```json | ||
{ | ||
"x-mws-quota-max": "60.0", | ||
"x-mws-quota-remaining": "38.0", | ||
"x-mws-quota-resetson": "2017-12-08T08:21:00.000Z", | ||
"x-mws-timestamp": "2017-12-08T07:52:15.567Z" | ||
} | ||
### Subscriptions | ||
|
||
#### Create Subscription | ||
```js | ||
amazonMws.subscriptions.create({ | ||
'Version': '2013-07-01', | ||
'Action': 'CreateSubscription', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'Subscription.Destination.AttributeList.member.1.Key': 'DESTINATION_KEY', | ||
'Subscription.Destination.AttributeList.member.1.Value': 'DESTINATION_VALUE', | ||
'Subscription.Destination.DeliveryChannel': 'DESTINATION_CHANNEL', | ||
'Subscription.IsEnabled': 'true', | ||
'Subscription.NotificationType': 'AnyOfferChanged' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
``` | ||
Originally by [Bhushankumar Lilapara](https://github.com/bhushankumarl) ([email protected]). | ||
|
||
#### Delete Subscription | ||
```js | ||
amazonMws.subscriptions.remove({ | ||
'Version': '2013-07-01', | ||
'Action': 'DeleteSubscription', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'Destination.AttributeList.member.1.Key': 'DESTINATION_KEY', | ||
'Destination.AttributeList.member.1.Value': 'DESTINATION_VALUE', | ||
'Destination.DeliveryChannel': 'DESTINATION_CHANNEL', | ||
'NotificationType': 'AnyOfferChanged' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
``` | ||
|
||
#### List Subscription | ||
```js | ||
amazonMws.subscriptions.searchFor({ | ||
'Version': '2013-07-01', | ||
'Action': 'ListSubscriptions', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
examples/javaScript/recommendations/getLastUpdatedTimeForRecommendations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY'; | ||
var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET'; | ||
|
||
var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret); | ||
|
||
/** | ||
* If the response is empty than it means their is no recommendation. | ||
*/ | ||
var recommendationRequest = function () { | ||
amazonMws.recommendations.searchFor({ | ||
'Version': '2013-04-01', | ||
'Action': 'GetLastUpdatedTimeForRecommendations', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
}; | ||
|
||
recommendationRequest(); |
30 changes: 30 additions & 0 deletions
30
examples/javaScript/recommendations/listRecommendations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY'; | ||
var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET'; | ||
|
||
var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret); | ||
|
||
/** | ||
* If the response is empty than it means their is no recommendation. | ||
*/ | ||
var recommendationRequest = function () { | ||
amazonMws.recommendations.searchFor({ | ||
'Version': '2013-04-01', | ||
'Action': 'ListRecommendations', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1': 'QualitySet=Defect', | ||
'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.2': 'ListingStatus=Active', | ||
'CategoryQueryList.CategoryQuery.1.RecommendationCategory': 'ListingQuality' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
}; | ||
|
||
recommendationRequest(); |
25 changes: 25 additions & 0 deletions
25
examples/javaScript/sample/getMatchingProductAsyncAwait.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY'; | ||
var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET'; | ||
|
||
var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret); | ||
|
||
var productRequest = async function () { | ||
|
||
try { | ||
var response = await amazonMws.products.search({ | ||
'Version': '2011-10-01', | ||
'Action': 'GetMatchingProduct', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'ASINList.ASIN.1': 'ASIN_1' | ||
}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error products', error); | ||
} | ||
}; | ||
|
||
productRequest(); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY'; | ||
var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET'; | ||
|
||
var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret); | ||
|
||
var subscriptionRequest = function () { | ||
amazonMws.subscriptions.create({ | ||
'Version': '2013-07-01', | ||
'Action': 'CreateSubscription', | ||
'SellerId': 'SELLER_ID', | ||
'MWSAuthToken': 'MWS_AUTH_TOKEN', | ||
'MarketplaceId': 'MARKET_PLACE_ID', | ||
'Subscription.Destination.AttributeList.member.1.Key': 'DESTINATION_KEY', | ||
'Subscription.Destination.AttributeList.member.1.Value': 'DESTINATION_VALUE', | ||
'Subscription.Destination.DeliveryChannel': 'DESTINATION_CHANNEL', | ||
'Subscription.IsEnabled': 'true', | ||
'Subscription.NotificationType': 'AnyOfferChanged' | ||
}, function (error, response) { | ||
if (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
console.log('response', response); | ||
}); | ||
}; | ||
|
||
subscriptionRequest(); |
Oops, something went wrong.