Post

1 follower Follow
0
Avatar

finding space_id by url

the following code returns a fatal error: Fatal error: Uncaught exception 'PodioNotFoundError' with message 'No matching operation could be found. Missing parameters: url

can anyone give me a clue to why this will not work

<?php ob_start("ob_gzhandler");?>

<?php

/*

This file is to be used to obtain a space id using the space url.

You may use this file in conjunction with another file i.e. 'podio_customer_import_space.php such that the space_id is a required field.

*/

//import the required files

require_once('Podio_Master/config.php'); //change as necessary to locate the root folder of the config.php file

require_once('Podio_Master/PodioAPI.php'); //change as necessary to locate the root folder of the PodioAPI.php file

require_once('Podio_Master/examples/username_password_auth.php'); //change as necessary to locate the root folder of the username_password_auth.php file

$space_id = PodioSpace::get_for_url("https://myurl.podio.com", $attributes = array() );

echo $space_id;

?>

Nick George Answered

Please sign in to leave a comment.

5 comments

0
Avatar

Hey Nick,

That URL is not a full space URL -- you need the full URL including the space name path component.

Also, get rid of the $attributes=array() part as it doesn't make sense. Either pass in attributes or leave it out completely

/Andreas

Andreas Haugstrup Pedersen 0 votes
0
Avatar

That's exactly what I thought, hence that is exactly what I had the first time and it still gives me the same error.

 

Fatal error: Uncaught exception 'PodioNotFoundError' with message 'No matching operation could be found. Missing parameters: url.

Nick George 0 votes
0
Avatar

Hi Nick,

As you can see on the documentation page I linked to the method takes an $attributes array as the function parameter. This is how all the methods work.

So you have to pass in array of attributes, not just a string. I.e.:

PodioSpace::get_for_url(array("url" => "https://myurl.podio.com/space"));

I will strongly recommend that you run the client in debug mode as you can monitor the log and see if what you are trying to send is actually being sent. Details here https://github.com/podio/podio-php#debugging--error-handling

I have changed the client so it will throw an exception if the attributes parameter is not an array. If you grab the latest version of the client it will complain loudly if you try to send a string as the attributes. Commit here: https://github.com/podio/podio-php/commit/3d3a6b3569e9bccc888432364228128ad50d22b0

All the best,

Andreas 

Andreas Haugstrup Pedersen 0 votes