I am trying to get all organization items through http://host/api/v3/organizations?page=2&per_page=100
The default size seems like 30, and 100 seems like the max limit per request.
But above link still only returns the first 100 items, i.e, not 101-200th
I also tried http:host//api/v3/organizations?page=2
No matter which page I set, it only returns the first 30 items.
How can I get the entire list of organization items please? Please help. Appreciate.
From Github API reference for listing organizations :
Note: Pagination is powered exclusively by the since parameter. Use
the Link header to get the URL for the next page of organizations.
For instance checking the 2nd page using curl :
curl -I "https://api.github.com/organizations"
gives the following link header :
Link: <https://api.github.com/organizations?since=3043>; rel="next", <https://api.github.com/organizations{?since}>; rel="first"
So the next page will be https://api.github.com/organizations?since=3043
For each request you would check this header to get the next url to hit
Related
We have found this bug in Api Manager that whenever you pass some similar words in the url its working properly even the url was not correct .
Example:
working url: {{Url}}/regulators
bad url but works with the same : {{Url}}/../auth/streams/../../regulators
Anybody encounter the same issue with your APIs?
Please see image below
Method GET is used to add form data to the URL in name or value pair. If you use GET, the length of URL will remain limited. It helps users to submit the bookmark the result. GET is better for the data which does not require any security or having images or word documents.
Also, this is used only to get the data from address bar in the browser.
We can check with below settings for API Responses:
Select the API you created in the previous step.
Select + Add Operation.
In the Frontend window, enter the following values.
Display Name(test call) : The name that is displayed in the developer portal.
URL(HTTP Verb) – GET : Select one of the predefined HTTP verbs.
URL (/test) : A URL path for API.
Description: Optional description of the operation, used to provide documentation in the developer portal to the developers using this API.
Select the Responses tab, located under the URL, Display name, and Description fields. Enter settings on this tab to define response status codes, content types, examples, and schemas.
Select + Add response, and select 200 OK from the list.
Under the Representations heading on the right, select + Add representation.
Enter application/json into the search box and select the application/json content type.
In the Sample text box, enter { "sampleField" : "test" }.
Select Save.
Refer to MS Docs to Monitor published API’s
I am trying to get the groups and group members in the office 365 by API.
I am able to get the group and group member list by using below API
https://graph.microsoft.com/v1.0/groups
https://graph.microsoft.com/v1.0/groups/e875D371-db4c-4371-b315-5970fXXXff76/members
Here my problem is I need to get the next page of the graph explorer. How could I get the next page of result?
I tried the &$skiptoken but it did not work or maybe I have not used correctly!
Can anyone kindly guide me to get the next page of the result?
Use below example code
https://graph.microsoft.com/beta/groups/9ckkqecb-43c6-4295-ac69-02bcaeac6570/members?$top=999&$select=id,displayName
this will give the first 999 result.
$skiptoken is described in the official docs here. To summarize, results that are paged will have a "#odata.nextLink" in the response. This value is the resource you will use to get the rest of the results. You can chain links together over and over, if necessary, until the entire result set is returned.
when using github users api to return users data through
https://api.github.com/users?page=6&per_page=2
return the same data every one although change page parameter value and per_page
why this and how to fix to change different data
i try to edit header request and add this header
Name Link
Value <https://api.github.com/users?page=1&per_page=2>; rel="next",<https://api.github.com/users?page=50&per_page=2>; rel="last"
But Still not working
After my search
now Github use API V3 and if you want return users with paging you can use this
https://api.github.com/users?since=1&per_page=100
Instead of using "page" and "per_page", that endpoint uses "since" and "per_page".
The since parameter says from which user ID the API should start listing users. For example:
https://api.github.com/users?since=1&per_page=100
will start listing users from the user with ID 1, and
https://api.github.com/users?since=10001&per_page=100
will start listing users from the user with ID 10001.
I'm after the impression uniques for our posts and ideally we would like one server call and it would bring back the last 100 posts with the reach (post_impressions_unique).
To get reach, I can currently do this using:
https://graph.facebook.com/nmemagazine/posts?fields=name,message,full_picture,created_time,shares,likes.limit(1).summary(true),comments.limit(1).summary(true)&access_token=USER_TOKEN
and getting the post ID, then calling: https://graph.facebook.com/v2.5/POST_ID/insights/post_impressions_unique?access_token=USER_TOKEN
Is there a way where I can make one call to get all recent posts and their reach in one API call?
You could simply call
https://graph.facebook.com/nmemagazine/posts?fields=name,message,full_picture,created_time,shares,likes.limit(1).summary(true),comments.limit(1).summary(true),insights&access_token=USER_TOKEN
NOTE: extra field "insights".
However, as far as I can tell you cannot limit the insights to just Post_impressions_Unique so it would bring back some data you do not necessarily want/need. I.e. I don't think you can perform a search/filter on a "second level"/child/nested type.
To give an update on this:
In facebook Graph API 2.10, you can (and have to) specify the metrics you are interested in via insights.metric(...). Possible metrics are documented here:
https://developers.facebook.com/docs/graph-api/reference/v2.10/insights#availmetrics
For your example:
curl -i -X GET "https://graph.facebook.com/nmemagazine/posts?fields=name,message,full_picture,created_time,shares,likes.limit(1).summary(true),comments.limit(1).summary(true),insights.metric(post_impressions_unique)&access_token=USER_TOKEN"
I have two examples:
Example 1:
https://www.facebook.com/cocacola
I get "likes","description" at https://graph.facebook.com/cocacola/
It work.
Example 2:
https://www.facebook.com/selectivefitness
I get errors at https://graph.facebook.com/selectivefitness/
Why example 2 does not working? How i can get "likes" "description" of https://www.facebook.com/selectivefitness
It's because of restrictions on the page (either country restrictions or age restriction). You just need a valid Access Token to fix it.
Try making a request to the URL using that Access Token. Something like:
https://graph.facebook.com/selectivefitness?access_token={Access_Token}
You can always make use of Graph API Explorer to test your requests and queries.