Ubidots API php getValues

Hello,

I’m starting with Ubidots API for php. I’m able to publish but not to get Values:

This is my php code:

<?php require 'vendor/autoload.php'; $api = new Ubidots\ApiClient($apikey = "xxxxxxxxxx"); $my_variable = $api->get_variable("yyyyyyyyyyy"); $new_value = $my_variable->save_value(json_encode(array('value' => 20))); $some_values = $my_variable->get_values(3); ?>

And these the errors:

Warning : range(): step exceeds the specified range in D:\Mis webs\test\Ubidots\vendor\ubidots\ubidots\src\Ubidots\Paginator.php on line 29

Warning : Invalid argument supplied for foreach() in D:\Mis webs\test\Ubidots\vendor\ubidots\ubidots\src\Ubidots\Paginator.php on line 29

Warning : array_values() expects parameter 1 to be array, boolean given in D:\Mis webs\test\Ubidots\vendor\ubidots\ubidots\src\Ubidots\Paginator.php on line 132

Warning : array_slice() expects parameter 1 to be array, null given in D:\Mis webs\test\Ubidots\vendor\ubidots\ubidots\src\Ubidots\Paginator.php on line 103

Hello @omega,

Could you please verify that your API Key and Variable ID are the proper?

In order to help better, could you please advise your username?

Hello @sergio

API Key and variable ID are ok because I am able to publisb values to the varible, but not able to get the last 3 values of the same variable.
My username is j.fernandez
Thank you,

@omega, thanks for confirming. I’d recommend to check out the following community post, there’s a workaround that might help you retrieving data from Ubidots.

Best.