[SOLVED] Java just recieve 50 datapoints from ubidots, how can i get all datapoints?

this is my code
ApiClient api = new ApiClient(“ca370177019c13a671a9f7fae17ffca4986f61a6”);
Variable Temperatura = api.getVariable(“57a3591e762542603827143d”);
Value[] values = Temperatura.getValues();

for (Value Value : values) {
System.out.println(Value.getValue());
}

how can i take all the datapoints ???

1 Like

For informational purposes, the thread has been created in GitHub as well, you can check it here (it’s in Spanish): https://github.com/ubidots/ubidots-java/issues/11

As I told the user (@sergioF), the library at this moment only supports up to 50 values per request because that’s the default amount of values that Ubidots API returns per page.
It could be changed with the parameter page_size at the end of the URL set with the number of values that the user wants.

I’d suggest two workarounds at the moment while the official library is updated and uploaded to Maven:

  1. Fork the library and modify just the line that sends the request to Ubidots for getting the values and add the ?page_size=100 parameter at the end of the String (note that 100 is the amount of Values the person want).

The line I’m talking about is Line 33 at Variable.java file.

  1. And I don’t know if this would work, is to create a new class that extends the Variable class. And override the getValues() method of the Variable.java file, only adding the same ?page_size=100 parameter at the end of the String.

These are the workarounds I think could help you if you need urgently to get more than 50 values. But they doesn’t mean I’m not going to add that feature to the library, I’ll try to do it as soon and fast as I can :smile:

Thanks so much for that feature request, BTW.

Thanks Juanda for everything i could do it SOLVED