dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:
https://developers.pinterest.com/docs/getting-started/introduction/
Apache License 2.0
173 stars 76 forks source link

404 Error #48

Closed helloarpitgshah closed 8 years ago

helloarpitgshah commented 8 years ago

Hey,

I have added some code to create the board and I got the following error every time,

Fatal error: Uncaught exception 'DirkGroenen\Pinterest\Exceptions\PinterestException' with message 'Pinterest error (code: 404) with message: Board not found.'

$pin_board = $pinterest->boards->create(array(
    "name"          => "Name",
    "description"   => "Description",
    "creator"   => "",

));

Can you please help me?

dirkgroenen commented 8 years ago

I just checked it out using the following code and everything is working fine:

$pinterest->boards->create(array(
     "name"          => "Test board from API",
    "description"   => "Test Board From API Test"
));

Are you sure that error message is a follow up on your creation code and not a pins->create request or something like that?

helloarpitgshah commented 8 years ago

Yes, I have Create Board and Create Pins both code in line,

$pintresponse = $pinterest->pins->create(array( "board" => "username/test-board", 'image_url' => $imageurl, 'note' => $message, 'link' => $link ));

I am not sure if we also get error from the create the pins.

Can you please help me?

dirkgroenen commented 8 years ago

I think the error is quite self-explaining: the board you're trying the put the pin on doesn't exist. Make sure the board you're referring to exists.

helloarpitgshah commented 8 years ago

I have create the board first and add the pins on the same with adding "-" with the name.

Can you please let me know how can we get the board name from board create code?

Do you have both the code run perfectly?

dirkgroenen commented 8 years ago

You can't get the board name from the first response, though I might be able to add this to the model. For now you have to create the board name yourself, which ain't so hard since the board name is nothing more than your username and lowercase boardname with spaces replaced for -.

It tested the code this afternoon and I can create a board and place pins on it without errors.

helloarpitgshah commented 8 years ago

Hey,

I got the success with the creating the Board.

There are another issues that if we have already created the board then also we got the same issues.

I am going to search with the board first with the following code,

$Boardresponse = $pinterest->users->searchMeBoards("test");

$response1 = $pinterest->assertInstanceOf( "DirkGroenen\Pinterest\Models\Collection", $Boardresponse );

$board = $pinterest->assertInstanceOf( "DirkGroenen\Pinterest\Models\Board", $Boardresponse->get(0) );

There are following error,

Fatal error: Call to undefined method DirkGroenen\Pinterest\Pinterest::assertInstanceOf();

Can you please help me?

dirkgroenen commented 8 years ago

Did you take the effort to read the README.md? You're using test methods which, of course, won't work.

I would suggest you to carefully read the readme, take a look at the demo and fiddle around.