dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:

Home Page:https://developers.pinterest.com/docs/getting-started/introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use fromBoard method?

VadimSS opened this issue · comments

I am used this method this way:

$resp = $pinterest->pins->fromBoard('giftsbrains/gifts-for-women', $data = []);

But I got just first 25 pins from this board. How I can fetch all the pins from this board?
I have no idea how ho use array $data parameter of this function, and what fields this array must include.

Responses with multiple instances are returned as a Collection. This class has the option to check a next page using hasNextPage().

If a next page is available you can retrieve the cursor from the Collection's pagination property and pass it along as $data = ['cursor' => $cursor] to your method.

$response = $pinterest->pins->fromBoard('giftsbrains/gifts-for-women');

if($response->hasNextPage()) {
  $cursor = $response->pagination['cursor'];
  $pinterest->pins->fromBoard('giftsbrains/gifts-for-women', [
    'cursor' => $cursor
  ]);
}

This will be in release 0.2.12