Adding query params doesn't seem to make any difference

A general discussion forum.
smallB007
Posts: 8
Joined: 28 Mar 2016, 18:00

Adding query params doesn't seem to make any difference

Postby smallB007 » 27 Apr 2016, 14:53

Hi guys,
Whilst interacting with github api and trying to receive commits for a repo, there is a default pagination limit == 30, that is, only 30 commits are retrieved through call to gitapi. There is a way to change the default number as well as retrieve another page and this is explained here:

https://developer.github.com/v3/#pagination

I've tried to set the parameter for the page to be 50 but this doesn't seem to change the fact that max only 30 commits are retrieved.
I've tried:

Code: Select all

Poco::URI uri_commits(url);
        uri_commits.addQueryParameter("?per_page", "50");
        //and I also have tried:
   uri_commits.setQuery("?per_page=40");

But none of those methods works.
I would really appreciate if somebody would help me with it.
Thank you.

alex
Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Adding query params doesn't seem to make any difference

Postby alex » 27 Apr 2016, 15:45

try omitting '?':

Code: Select all

uri_commits.addQueryParameter("per_page", "50");

smallB007
Posts: 8
Joined: 28 Mar 2016, 18:00

Re: Adding query params doesn't seem to make any difference

Postby smallB007 » 27 Apr 2016, 17:06

Hi Alex,
Good hearing from you.
I've tried your suggestion, alas, no luck.
Any ideas what to do in order for it to work?
Thank you.

alex
Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Adding query params doesn't seem to make any difference

Postby alex » 27 Apr 2016, 20:07

your problem likely has to do with github api requirements. print out uri.toString() and see if you can get what you are looking for using curl or browser. In particular, if curl works, try "curl -v" to see what headers are sent, you may have to set the user-agent header.

smallB007
Posts: 8
Joined: 28 Mar 2016, 18:00

Re: Adding query params doesn't seem to make any difference

Postby smallB007 » 29 Apr 2016, 09:57

Thanks Alex, will try that.
Best Regards and have a nice weekend.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests

cron