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

Uploading Images #11

Open
urielcastrillon08 opened this issue Apr 3, 2017 · 1 comment
Open

Uploading Images #11

urielcastrillon08 opened this issue Apr 3, 2017 · 1 comment

Comments

@urielcastrillon08
Copy link

hi
do you have a example of like Uploading Images for a Listing?
thank you

@hrharshrathi
Copy link

Hi
Here Is sample code to upload image in Etsy

const oauth = {
consumer_key: 'consumer_key',
consumer_secret: 'consumer_secret',
token: 'token',
token_secret: 'token_secret',
};
function uploadImage(listingId, image_path) {
const listing_id = listingId;
const file = fs.createReadStream(image_path);
const req = request.post({
url: https://openapi.etsy.com/v2/listings/${listing_id}/images`,`
oauth
}, (err, response, body) => {
if (err) {
console.log(err);
}
if (response.statusCode === 201) {
body = JSON.parse(body);
console.log(body.results[0]);
}
});
const form = req.form();
form.append('image', file);
form.append('rank', imageData.productImageID);
}

Feel free if you find any difficulty

!! Happy Coding !!

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

2 participants