etoxin
etoxin

Reputation: 5274

Create a new Pin with the Pinterest Javascript SDK

I'm trying to create a new Pinterest Pin with the PDK JS api (https://developers.pinterest.com/docs/sdks/js/).

PDK.pin({
    image_url: ImageUrl,
    note: Description,
    link: ShareUrl
}, function(res){
    console.log(res);
});

It makes the request but none of the params (image, link and note) seem to pass to the api. A working example of the pinterest share pdk working can be found on this website: http://www.vogue.com/13382189/fair-isle-sweaters-runway-christmas-style/

Upvotes: 1

Views: 1673

Answers (2)

sigfy
sigfy

Reputation: 11

The syntaxe is more like this apparently:

PDK.pin( ImageUrl, Description, ShareUrl, function(){
  // Do whatever you like
});

image_url, note and link variables are passed as parameters and not as object elements. Also the callback is triggered whenever the window is closed and doesn't return any response, so there is no way to know if the image has indeed been pinned or not.

Upvotes: 1

etoxin
etoxin

Reputation: 5274

I found out that the site was making a pin like so:

window.open(
    'https://www.pinterest.com/pin/create/button/?url=' + data.pdkShareUrl + '&media=' + data.pdkImageUrl + '&description=' + data.pdkDescription,
    'share',
    'width=600, height=300'
);

Upvotes: 0

Related Questions