Reputation: 3012
According to several blog posts and the development site the v3 API is only partially available (and hardly documented). I found the endpoint I need in this article:
https://api.pinterest.com/v3/pidgets/boards/{username}/{board}/pins/
which returns pins like this one:
{
"attribution": {
"title": "Blue",
"url": "http://500px.com/photo/8371303",
"provider_icon_url": "http://passets-ak.pinterest.com/images/api/attrib/[email protected]",
"author_name": "Eddie Chui",
"provider_favicon_url": "http://passets-ec.pinterest.com/images/api/attrib/fivehundredpx.png",
"author_url": "http://500px.com/EddieChui",
"provider_name": "fivehundredpx"
},
"description": "Khiva Uzbekistan",
"pinner": {
"image_small_url": "http://media-cache-ec0.pinimg.com/avatars/iweczek-1349184554_30.jpg",
"profile_url": "http://www.pinterest.com/highquality/",
"full_name": "A B"
},
"dominant_color": "#434744",
"link": "http://500px.com/photo/8371303",
"images": {
"237x": {
"url": "http://media-cache-ak0.pinimg.com/237x/b4/14/66/b414661df939392b2f0425e394be83db.jpg",
"width": 237,
"height": 359
}
},
"is_video": false,
"id": "159596380518659971"
}
According to the domain api docs there is a possibility to specify what image sizes you would like to receive by providing:
pin.images=[64x64,75x75,1200x]
Any idea if this is possible for the specified endpoint? If yes, how do I include it in the request?
Upvotes: 3
Views: 7066
Reputation: 11
In asp.Net C#, I used:
using Newtonsoft.Json;
var results = JsonConvert.DeserializeObject<dynamic>(Response);
foreach (var data in results.data.pins)
{
string str = Convert.ToString(data.images["237x"].url);
str = BigImg.Replace("237x", "736x");
}
It worked for me. Hope same for you.
Upvotes: 1
Reputation: 41
You can get to the larger images by using the API to get to the 237x size and then replacing it with "originals" in the url
$.ajax({
type: "GET",
dataType: "jsonp",
url: "https://api.pinterest.com/v3/pidgets/boards/vicemag/magazine/pins/" ,
success: function(data) {
var npins = data.data.pins.length
for (var i = 0; i < npins; i++) {
var a = data.data.pins[i].images["237x"].url,
a = a.replace('237x','originals')
}
}
});
Upvotes: 4
Reputation: 3012
As of June 2014 it is not possible to use the full Pinterest v3 API without an API-KEY. The API is not public so it is quite hard to get an API-KEY from Pinterest. To request a KEY you have to specify what kind of application you use it for, including mockups/wireframes. The form to request a key is located here. But there was no response from Pinterest for my requests, not even when requesting it for research purposes from a CS faculty of a well known university.
Some very basic features of the original Pinterest API have been replicated by this API. But it is extremely slow because it relies on scraping the Pinterest page and I guess any changes to the DOM will break it. The support is also limited.
The mentioned API is based on PhantomJsCloud. It uses this file for the scraping so If you want to use it productively I would advise you to directly use PhantomJsCloud and modify the specified file so you can react to DOM changes of Pinterest and be able to change the API response because as I said, the support of the other API is limited.
Upvotes: 1