Skip to content

Commit e58d2e3

Browse files
author
Bhushankumar L
authored
Merge pull request #99 from bhushankumarl/development
Development
2 parents e531635 + f330cee commit e58d2e3

27 files changed

+1022
-667
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[vcbuild.bat]
12+
end_of_line = crlf
13+
14+
[Makefile]
15+
indent_size = 8
16+
indent_style = tab
17+
18+
[{deps}/**]
19+
charset = unset
20+
end_of_line = unset
21+
indent_size = unset
22+
indent_style = unset
23+
trim_trailing_whitespace = unset
24+
25+
[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
26+
insert_final_newline = false

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export DEBUG=MWS:*
3434
```bash
3535
export AWS_ACCESS_KEY_ID=KEY
3636
export AWS_SECRET_ACCESS_KEY=SECRET
37+
38+
#optional MWS Token
39+
export MWS_AUTH_TOKEN=TOKEN
40+
41+
#optional proxy
42+
export MARKETPLACE_PROXY=http://your.proxy.domain
3743
```
3844

3945
## Configuration Using JavaScript
@@ -174,9 +180,47 @@ Originally by [Bhushankumar L](mailto:bhushankumar.lilapara@gmail.com).
174180
});
175181
```
176182

177-
#### Submit Feed
183+
#### Get Feed Submission Result as Stream
184+
```
185+
/**
186+
* Use __STREAM__ to get the request in response;
187+
*/
188+
var FeedSubmissionId = '10101010XXX';
189+
amazonMws.feeds.search({
190+
'Version': '2009-01-01',
191+
'Action': 'GetFeedSubmissionResult',
192+
'SellerId': 'SELLER_ID',
193+
'MWSAuthToken': 'MWS_AUTH_TOKEN',
194+
'FeedSubmissionId': FeedSubmissionId,
195+
__STREAM__: true
196+
}, function (error, response) {
197+
if (error) {
198+
console.log('error ', error);
199+
return;
200+
}
201+
response
202+
.pipe(iconv.decodeStream('ISO-8859-1'))
203+
.pipe(
204+
csv.parse({
205+
delimiter: '\t',
206+
headers: true,
207+
discardUnmappedColumns: true,
208+
quote: null,
209+
ignoreEmpty: true,
210+
trim: true
211+
})
212+
)
213+
.on('data', row => {
214+
processRow(row);
215+
})
216+
.on('error', error => { console.error(error); })
217+
.on('end', rowCount => { console.log(`Processed rows ${rowCount}`); });
218+
});
219+
```
220+
221+
#### Submit Feed [more feed xml demo](https://github.com/bhushankumarl/amazon-mws/tree/master/examples/javascript/feeds). or see https://images-cn.ssl-images-amazon.com/images/G/28/rainier/help/XML_Documentation_Intl._V158771171_.pdf
178222
```
179-
var FeedContent = fse.readFileSync('./file.txt', 'UTF-8');
223+
var FeedContent = fse.readFileSync('./good.xml', 'UTF-8');
180224
console.log('FeedContent ', FeedContent);
181225
182226
amazonMws.feeds.submit({

examples/javaScript/feeds/file.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

examples/javaScript/feeds/good.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd">
3+
<Header>
4+
<DocumentVersion>1.01</DocumentVersion>
5+
<MerchantIdentifier>SellerID</MerchantIdentifier>
6+
</Header>
7+
<MessageType>Product</MessageType>
8+
<PurgeAndReplace>false</PurgeAndReplace>
9+
<Message>
10+
<MessageID>1</MessageID>
11+
<OperationType>Update</OperationType>
12+
<Product>
13+
<SKU>xxx-9527</SKU>
14+
<StandardProductID>
15+
<Type>EAN</Type>
16+
<Value>xxxxx</Value>
17+
</StandardProductID>
18+
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
19+
<DescriptionData>
20+
<Title>Example Product Title</Title>
21+
<Brand>Example Product Brand</Brand>
22+
<Description>This is an example product description.</Description>
23+
<BulletPoint>Example Bullet Point 1</BulletPoint>
24+
<BulletPoint>Example Bullet Point 2</BulletPoint>
25+
<MSRP currency="JPY">55.55</MSRP>
26+
<Manufacturer>Example Product Manufacturer</Manufacturer>
27+
<SearchTerms>yaodian1</SearchTerms>
28+
<SearchTerms>yaodian2</SearchTerms>
29+
<ItemType>example-item-type</ItemType>
30+
</DescriptionData>
31+
<ProductData>
32+
<Health>
33+
<ProductType>
34+
<HealthMisc>
35+
<Ingredients>Example Ingredients</Ingredients>
36+
<Directions>Example Directions</Directions>
37+
</HealthMisc>
38+
</ProductType>
39+
</Health>
40+
</ProductData>
41+
</Product>
42+
</Message>
43+
</AmazonEnvelope>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd">
3+
<Header>
4+
<DocumentVersion>1.01</DocumentVersion>
5+
<MerchantIdentifier>SellerID</MerchantIdentifier>
6+
</Header>
7+
<MessageType>ProductImage</MessageType>
8+
<Message>
9+
<MessageID>1</MessageID>
10+
<OperationType>Update</OperationType>
11+
<ProductImage>
12+
<SKU>sku</SKU>
13+
<ImageType>Swatch</ImageType>
14+
<ImageLocation>http://images.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg</ImageLocation>
15+
</ProductImage>
16+
</Message>
17+
</AmazonEnvelope>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd">
3+
<Header>
4+
<DocumentVersion>1.01</DocumentVersion>
5+
<MerchantIdentifier>SellerID</MerchantIdentifier>
6+
</Header>
7+
<MessageType>Inventory</MessageType>
8+
<Message>
9+
<MessageID>1</MessageID>
10+
<OperationType>Update</OperationType>
11+
<Inventory>
12+
<SKU>SKU</SKU>
13+
<Quantity>9527</Quantity>
14+
<FulfillmentLatency>1</FulfillmentLatency>
15+
</Inventory>
16+
</Message>
17+
</AmazonEnvelope>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd">
3+
<Header>
4+
<DocumentVersion>1.01</DocumentVersion>
5+
<MerchantIdentifier>SellerID</MerchantIdentifier>
6+
</Header>
7+
<MessageType>Price</MessageType>
8+
<Message>
9+
<MessageID>1</MessageID>
10+
<Price>
11+
<SKU>SKU</SKU>
12+
<StandardPrice currency="DEFAULT">99.99</StandardPrice>
13+
</Price>
14+
</Message>
15+
</AmazonEnvelope>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amznenvelope.xsd">
3+
<Header>
4+
<DocumentVersion>1.01</DocumentVersion>
5+
<MerchantIdentifier>SellerID</MerchantIdentifier>
6+
</Header>
7+
<MessageType>Relationship</MessageType>
8+
<Message>
9+
<MessageID>1</MessageID>
10+
<OperationType>Update</OperationType>
11+
<Relationship>
12+
<ParentSKU>paret-sku</ParentSKU>
13+
<Relation>
14+
<SKU>child-sku</SKU>
15+
<Type>Variation</Type>
16+
</Relation>
17+
</Relationship>
18+
</Message>
19+
</AmazonEnvelope>

examples/javaScript/feeds/submitFeed.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret);
77
var fse = require('fs-extra');
88

99
var feedRequest = function () {
10-
var FeedContent = fse.readFileSync('./file.txt', 'UTF-8');
10+
var FeedContent = fse.readFileSync('./good.xml', 'UTF-8');
1111
console.log('FeedContent ', FeedContent);
1212

1313
amazonMws.feeds.submit({
@@ -26,4 +26,4 @@ var feedRequest = function () {
2626
});
2727
};
2828

29-
feedRequest();
29+
feedRequest();
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="iso-8859-1"?>
2+
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
4+
<Header>
5+
<DocumentVersion>1.01</DocumentVersion>
6+
<MerchantIdentifier>SellerID</MerchantIdentifier>
7+
</Header>
8+
<MessageType>Product</MessageType>
9+
<PurgeAndReplace>false</PurgeAndReplace>
10+
<Message>
11+
<MessageID>1</MessageID>
12+
<OperationType>Update</OperationType>
13+
<Product>
14+
<SKU>SKU</SKU>
15+
<StandardProductID>
16+
<Type>EAN</Type>
17+
<Value>XXX</Value>
18+
</StandardProductID>
19+
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
20+
<DescriptionData>
21+
<Title>Example Parent</Title>
22+
<Brand>Example Product Brand</Brand>
23+
<Description>This is an example product description.</Description>
24+
<BulletPoint>Example Bullet Point 1</BulletPoint>
25+
<BulletPoint>Example Bullet Point 2</BulletPoint>
26+
<MSRP currency="JPY">55.55</MSRP>
27+
<Manufacturer>Example Product Manufacturer</Manufacturer>
28+
<SearchTerms>yaodian1</SearchTerms>
29+
<SearchTerms>yaodian2</SearchTerms>
30+
<ItemType>example-item-type</ItemType>
31+
<RecommendedBrowseNode>4284945031</RecommendedBrowseNode>
32+
</DescriptionData>
33+
<ProductData>
34+
<Home>
35+
<ProductType>
36+
<OutdoorLiving></OutdoorLiving>
37+
</ProductType>
38+
<Parentage>variation-parent</Parentage>
39+
<VariationData>
40+
<VariationTheme>Size-Color</VariationTheme>
41+
<Size>XXL</Size>
42+
<Color>RED</Color>
43+
</VariationData>
44+
<Material>cotton</Material>
45+
<ThreadCount>500</ThreadCount>
46+
</Home>
47+
</ProductData>
48+
</Product>
49+
</Message>
50+
</AmazonEnvelope>

0 commit comments

Comments
 (0)