There are currently 1205 resources (citations) in the SciTS Mendeley group. However, no matter how we call the “getDocuments” method of the API, we only get the first 1000 resources. Is there a specific parameter we need to pass to get the full list of resources? Or is there a way to make a subsequent call that gets data pages not returned by the first call?
string grantType = "client_credentials"; string applicationID = "id"; string clientsecret = "XXXXXXX"; string redirecturi = "*******"; string url = "https://api-oauth2.mendeley.com/oauth/token"; string view = "all"; string group_id = "f7c0e437-f68b-34df-83c7-2877147ba8f9"; HttpWebResponse response = null; try { // Create the data to send StringBuilder data = new StringBuilder(); data.Append("client_id=" + Uri.EscapeDataString(applicationID)); data.Append("&client_secret=" + Uri.EscapeDataString(clientsecret)); data.Append("&redirect_uri=" + Uri.EscapeDataString(redirecturi)); data.Append("&grant_type=" + Uri.EscapeDataString(grantType)); data.Append("&response_type=" + Uri.EscapeDataString("code")); data.Append("&scope=" + Uri.EscapeDataString("all")); byte[] byteArray = Encoding.UTF8.GetBytes(data.ToString()); // Setup the Request HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = byteArray.Length; // Write data Stream postStream = request.GetRequestStream(); postStream.Write(byteArray, 0, byteArray.Length); postStream.Close(); // Send Request & Get Response response = (HttpWebResponse)request.GetResponse(); string accessToken; using (StreamReader reader = new StreamReader(response.GetResponseStream())) { // Get the Response Stream string json = reader.ReadLine(); Console.WriteLine(json); // Retrieve and Return the Access Token JavaScriptSerializer ser = new JavaScriptSerializer(); Dictionary<string, object> x = (Dictionary<string, object>)ser.DeserializeObject(json); accessToken = x["access_token"].ToString(); } // Console.WriteLine("Access TOken"+ accessToken); var apiUrl = "https://api-oauth2.mendeley.com/oapi/documents/groups/3556001/docs/?details=true&items=1250"; try { request = (HttpWebRequest)WebRequest.Create(apiUrl); request.Method = "GET"; request.Headers.Add("Authorization", "Bearer " + accessToken); request.Host = "api-oauth2.mendeley.com"; response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream())) { // Get the Response Stream string json = reader.ReadLine(); Console.WriteLine(json); //need this to import documents } } catch (WebException ex1) { Console.WriteLine("Access TOken exception" + ex1.Message); } } catch (WebException e) { if (e.Response != null) { using (HttpWebResponse err = (HttpWebResponse)e.Response) { Console.WriteLine("The server returned '{0}' with the status code '{1} ({2:d})'.", err.StatusDescription, err.StatusCode, err.StatusCode); } } }
Asked
Active
Viewed 146 times
0
1 Answers
0
The default number of items returned is limited to 1000 per page. For a paginated response you should get some additional fields in the response; notably 'items_per_page','total_pages','total_results'.
I suspect you have will two pages and to get the next result you need to append 'page=1'.

MendeleyStack
- 146
- 4