Hi @shevchenator,

I'm not sure if skipping the encoding in that annotation can be done. You can 
take a look at the 
[RestAnnotationProcessor](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/internal/RestAnnotationProcessor.java)
 class to see how requests are generated based on the annotations to have an 
idea of what is going on (and perhaps improve it :)). If not possible and you 
don't want to add extra parameter to your methods, you can always add a second 
filter to the API, after the authentication one, and let it add the pagination 
parameter when required.

Anyway, the good approach to address this would be to take benefit of the 
jclouds pagination magic.

Once of the things that jclouds providers offer is transparent pagination. This 
means that even if the APIs return paginated results, jclouds returns "special" 
iterables that are able to fetch the next pages on demand when iterating. This 
makes all the pagination thing transparent to the user, and saves bandwith, etc.

If the CloudSigma API uses query parameters to configure which records/page you 
want to fetch, perhaps it could be good to implement that pagination in the 
provider. These are the steps to get this done:

* List methods methods provide a way to fetch a single page, and return an 
[IterableWithMarker](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/IterableWithMarker.java).
 This iterable provides a method to get the marker to the next page. A simple 
example about this is the 
[ImageApi](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java#L85-L91)
 in OpenStack Glance. The `ImageOptions` argument has the info (query 
parameters in your case) required to fetch a single page.
* There should also be a list method without query parameters, to fetch the 
entire list. This method must return a 
[PagedIterable](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/collect/PagedIterable.java).
 This is the "special" iterator that will fetch more pages as soon as they are 
needed when iterating it. Again, you can see a simple example in the 
[ImageApi](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java#L76-L83).
* You will need a response parser function to parse the `HttpResponse` into an 
`IterableWithMarker`, and another function to generate the `Pagediterable`. 
Following the Glance ImageApi  example, you can take a look at the 
[ParseImages](https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/internal/ParseImages.java)
 class, that cointains the logic of both parsers.

With that, there won't be a need to manually handle pagination, as jclouds will 
take care of transparently fetching the pages as soon as the `PagedIterable` is 
iterated.

HTH!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/12#issuecomment-22689554

Reply via email to