Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product Feed #60

Open
1Mpuls3 opened this issue Dec 30, 2016 · 9 comments
Open

Product Feed #60

1Mpuls3 opened this issue Dec 30, 2016 · 9 comments

Comments

@1Mpuls3
Copy link

1Mpuls3 commented Dec 30, 2016

Hi,

any news on the support of product feed?

I'm mainly interested in POST_PRODUCT_PRICING_DATA and POST_INVENTORY_AVAILABILITY_DATA.

Regards,

@tyscorp
Copy link
Contributor

tyscorp commented Dec 30, 2016

Waiting on #54.

For now you could generate your own XML and use SubmitFeed.

@1Mpuls3
Copy link
Author

1Mpuls3 commented Dec 30, 2016

Okay, any ETA?

And thanks for the second part, that'll do for now.

@tyscorp
Copy link
Contributor

tyscorp commented Dec 30, 2016

You would have to ask @dciccale :)

@1Mpuls3
Copy link
Author

1Mpuls3 commented Dec 30, 2016

Okay, thanks. Should I close this issue?

@1Mpuls3
Copy link
Author

1Mpuls3 commented Jan 2, 2017

Made it work with that, if anyone is interested.

let sku = req.query.sku;
let price = req.query.p;

if(!price || !sku)
	res.send(JSON.stringify('error'))

let obj = {
	"@": {
		"xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
		"xsi:noNamespaceSchemaLocation": "amzn-envelope.xsd"
	},
	Header: {
		DocumentVersion: '1.01',
		MerchantIdentifier: 'XXXXXXXXXX'
	},
	MessageType: 'Price',
	Message: [{
		MessageID: "1",
		Price: {
			SKU: sku,
			StandardPrice: {
				"@": {
					currency: "EUR"
				},
				"#": price
			}
		}
	}]
};

let options = {
	declaration: {
		encoding: 'iso-8859-1'
	},
	format: {
		doubleQuotes: true
	}
};

let xml = js2xml.parse('AmazonEnvelope', obj, options)
	.replace(/>\s+/g, '>'); // to minify it

mws.Feeds.SubmitFeed({
		FeedContent: xml,
		FeedType: '_POST_PRODUCT_PRICING_DATA_'
	})
	.then((response) => {
		console.log(response)
		res.send(JSON.stringify({ sku: sku, price: price, response: response, xml: xml }, null, 2))
	})
	.catch((e) => {
		console.log('error', e);
		res.send(JSON.stringify({ sku: sku, price: price, error: e, xml: xml }, null, 2))
	})

And to get the feed state

mws.Feeds.GetFeedSubmissionResult({
	FeedSubmissionId: "XXXXXXXX", // can be found in response.result.FeedSubmissionId
})
.then((response) => {
	console.log(response)

	res.send(JSON.stringify(response, null, 2))
})
.catch((e) => {
	console.log('error', e);
	res.send(JSON.stringify(e, null, 2))
})

Maybe that can help someone. Thanks for your help !

@dciccale
Copy link
Collaborator

dciccale commented May 9, 2017

@tyscorp @1Mpuls3 #54 was fixed by this PR #75, if there is still need/desire to do product feed, now's the time 😄

@1Mpuls3
Copy link
Author

1Mpuls3 commented May 10, 2017

Hey, thanks for the heads up! I'll look into upgrading my code with the new mws-api version sometime this months hopefully.

Good job :)

@dciccale
Copy link
Collaborator

@1Mpuls3 Product feed is still not implemented. What I wanted to say that now it can be implemented (:

@1Mpuls3
Copy link
Author

1Mpuls3 commented May 10, 2017

Oh right. I read too fast my bad.

I guess it would be better, it would make my app definitely cleaner and maybe help other people using your implementation of the mws-api.

I'll have to improve my app someday anyway, since I learnt a lot more about javascript and nodejs these last few months.
So I'd definitely like it if you implemented product feeds.

But it's not urgent, or a need at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants