Post

4 followers Follow
1
Avatar

PHP - get all files between specific dates

Im trying to get all files between specific dates, but im not sure how to.

I've tried with no success:

$files = PodioFile::get_all( $attributes = array(
 'attached_to' => 'item',
 'created_on' => array(
 "from" => "2016-05-19 02:00:00",
 "to" => "2016-02-19 02:00:00"
)

) );

Can you help?

Luis Almeida

Please sign in to leave a comment.

5 comments

1
Avatar

Hi, here it goes:

Warning: urlencode() expects parameter 1 to be string, array given in D:\xampp\htdocs\podio-php-4.3.0\lib\Podio.php on line 371

Fatal error: Uncaught PodioBadRequestError: "The values are not in the right format" Request URL: http://api.podio.com/file/?created_on= Stack Trace: #0 D:\xampp\htdocs\podio-php-4.3.0\lib\Podio.php(349): Podio::request('GET', '/file/', Array, Array) #1 D:\xampp\htdocs\podio-php-4.3.0\models\PodioFile.php(104): Podio::get('/file/', Array) #2 D:\xampp\htdocs\podio-php-4.3.0\get_files_dellent.php(29): PodioFile::get_all(Array) #3 {main} thrown in D:\xampp\htdocs\podio-php-4.3.0\lib\Podio.php on line 289

 

Luis Almeida 1 vote
0
Avatar

It looks like the PHP SDK is asking for a string in the 'created_on' property, but you're providing an array (which should work, according to the view doc).

Can you try passing a single date as string instead of an object?

If that works, the PHP SDK is not (yet) compatible with date ranges for files.

Domenico Matteo 0 votes
0
Avatar

i've tried:

'created_on' => '2016-05-02'

got this error:

Fatal error: Uncaught PodioBadRequestError: "The values are not in the right format" Request URL: http://api.podio.com/file/app/6107280/?limit=1&sort_by=created_on&created_on=2016-05-02 Stack Trace: #0 D:\xampp\htdocs\podio-php-4.3.0\lib\Podio.php(349): Podio::request('GET', '/file/app/61072...', Array, Array) #1 D:\xampp\htdocs\podio-php-4.3.0\models\PodioFile.php(68): Podio::get('/file/app/61072...', Array) #2 D:\xampp\htdocs\podio-php-4.3.0\get_files_dellent.php(31): PodioFile::get_for_app('6107280', Array) #3 {main} thrown in D:\xampp\htdocs\podio-php-4.3.0\lib\Podio.php on line 289

Luis Almeida 0 votes