How to fetch specific amount of users using github api v3? - api

When I want to fetch github users using this api: https://api.github.com/users it gives me back exactly 46 users. How can I fetch e.g. just 10 of them?

You can try and add the per_page directive in your API URL
By passing the per_page parameter, you can specify how many items you want each page to return, up to 100 items.
Let's try asking for 10 items about addClass:
curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&per_page=10"
Apply the same idea to api.github.com/users
The first "page" of result would be 10 users.

Related

Shopware 6 Product API limit with offset

When using Shopware 6 /api/product REST-API I do get an timeout.
I found out i can set an limit and an offset.
When I call the API with /api/product?limit=240&offset=240 I still get the first 240 products.
Also tried using Shopware 5 offset variant, where you use start instead of offset.
Both give the same result.
I also tried doing an POST instead of an GET request, also no success.
I even using /api/search/product...
Does anyone know how to correctly perform an offset?
In the shopware 6 API you can request paginated data by using limit and page parameters. The page roughly translates to the offset that is being used, instead of doing a request with an offset of 240 (as in your example) you would request the page=2 with a limit of 240 this would give you the results 241-480.
So instead of
/api/product?limit=240&offset=240
you should use
/api/product?limit=240&page=2
The limit and page parameters can be used in GET-Requests, but also in POST-Request in the JSON-Body or in the search endpoint.
Take a look at the official docs for reference.

Why cursor-based pagination in shopify ignores last page?

I'm using shopify api to get list of orders
For first request I use this URL:
https://my-shop-name.myshopify.com/admin/orders.json?status=any&order=created_at+desc&limit=250
and for all next use link to next page from response headers like described here:
Pagination with a link header
The problem is that last page or orders always gets ignored, because request for previous page doesn't contain link to next one.
That's weird, because it takes all orders from 4403 to 1153 (with 250 limit it's 13 pages) and it should make one more request (latest order number is 1101), to get latest 52 orders. Maybe the problem is in 250 limit parameter, but I don't know how to bypass it if I don't know exact number of orders

Can`t get ALL my instagram followers list even with pagination

i`m using this link to get my followers list usernames
https://api.instagram.com/v1/users/self/followed-by?access_token=XXXXXX
it returns 50 users with a pagination url for the next 50
the problem is the pagination url will stop showing after i reach 245 users, i do have more than 300.
when i tried to get a list os followers of another user thats not mine and its a public user with more than 600 followers i managed to get al the list
https://api.instagram.com/v1/users/{user-id}/followed-by?access_token=XXXXXX
so i said maybe i should change the request link and replace self with my userid because thats the only different between the two requests BUT still getting the same result, only 245.
https://api.instagram.com/v1/users/{my-user-id}/followed-by?access_token=XXXXXX
so is there another way to get all my followers usernames ? or Instagram is limiting this endpoint ?
thanks in advance :)
UPDATE
I even tried to add &count=-1 and it does not work
Tried &count=100 , &count=300 and still showing only to 245 users

YouTube API Search v3 - Start index?

I'm using the YouTube Search API to grab 5 videos per time under a specific keyword. But I've been trying and trying, but couldent find the parameter for the start index. Does anyone know how to add it, so it gets the next 5 videos etc..?
Current URL I have:
https://www.googleapis.com/youtube/v3/search?part=snippet&q=wiz+khalifa&type=video&key=AIzaSyB9UW36sMDA9rja_J0ynSYVcNY4G25
In the results of your first query, you should get back a nextPageToken field.
When you make the request for the next page, you must send this value as the pageToken.
So you need to add pageToken=XXXXX to your query, where XXXXX is the value you received in nextPageToken.
Hope this helps

Angellist api: How to get to second page of data?

I was looking at Angel list api (https://angel.co/api) and I noticed a section on pagination. It says entries are limited to max of 50 (for eg. https://api.angel.co/1/users/135/roles has 2 pages work of data but returns only 1 page). The documentation mentions pagination but does not say how to get 2nd page.
Any ideas?
Chetan
Add ?page=2 to the end of the request to get the second page.