Unable to retrieve item count for Sharepoint List through Microsoft Graph API - json

I am currently using the Microsoft Graph API to return data in JSON for a specific list through this URL:
https://graph.microsoft.com/v1.0/sites/{siteID}/lists/{listID}/items/{itemID}
I would like to return data for all the items in the list by iterating through the itemID which is a number like 1,2,3. Although I can do that, I don't know what number to iterate to - does anyone know the API call or the URL for getting the item count in a list. If I send a GET Request to the following URL:
https://graph.microsoft.com/v1.0/sites/{siteID}/lists/{listID}/items
I only get back 235 list item JSON objects (much less than the 1200 that actually exist in the list) so I can't read off the last json object ID as the count.
I can do a while loop till I get an 'id doesn't exist error' but there are some items that are being regularly deleted hence I may encounter the same error there as well.

It can retrieve only few items when sending the API query (100-200) items. So try to use the $top query parameter
Using top query parameter. You are able to retrieve maximum 3000 items using Graph API
https://graph.microsoft.com/v1.0/sites/{siteID}/lists/{listID}/items?$top=3000
Upvote if accepted as a answer

Related

Delete from json without the use of a 'real' id

In Angular:
I'm trying to delete items from a local json server using a http request.
The problem is that the items don't have 'real' id's. Their id's are strings which json doesn't recognises as id's (so far I know).
So when I try to search for an id (either to get it or delete it) I have to use for example:
"http://localhost:3000/watchlist?imdbID=tt5745872"
which gives an array with 1 item.
When using this in a delete request, it will result in a 404.
I was wondering if there is some kind of a workaround for doing this or do I really have to implement 'real' id's?
Context: I'm getting movies from an API and I then store those in an json server. As the API uses string id's, it would be a pain in the ass to try and implement a second id for the same object.

Getting a list of values from API Server

I am still learning about API fetching. I want to get a list of values instead of just one value.
I am currently calling this API https://www.omdbapi.com that returns a movie based off the name or id:
http://www.omdbapi.com/?t=nameOfMovie
When calling that url with something like 'batman' it returns one json value of one of the batman movies. How would I be able to fetch a list? Or would that be entirely up to the people who run the API?

Get the first object from the response body

I am using Angular $http get method for get results from mysql database it returns 3 rows i am sending these results from the server side using method
res.json(results);
and on client side i console these results it show results Array[3] which contains 3 objects i use the
now i tried 2 different methods to display each object separately
console.log(response[0]);
console.log(response.data[0]);
but it always show Array[3]
i need to get each element separately and store it in array
response structure is
>Array[3]
0:object
ID:1
Name:"xyz"
>__proto__:object
1:object
ID:2
Name:"abc"
i need to get first object and store it in Array

How to paginate with string provided in JSON result?

I am using Feedly API to access feeds from a particular rss feed. Take a look at this link (1). As you see, it only returns newest 20 items but I think it provides sort of a link to paginate to the next result. There is 'continuation' key provided in the result but it is a string and not a link.
How can I use that to fetch the next result? Is this even possible?
JSON response from the server
See http://developer.feedly.com/v3/streams/
You can pass the continuation key to get the next batch of results.
For example: https://cloud.feedly.com/v3/streams/contents?streamId=feed/http://feeds.engadget.com/weblogsinc/engadget?continuation=14de41de03e:f7bda:87649ed8

How do I connect a django rest framework json query result to dgrid/OnDemandGrid

My JSON store (django rest framework) returns keys for "count", "next", "previous", and "results".
"count" is the number of rows available.
"next" is the url for the next page of results (e.g. ids 26-50).
"previous" is the url for the previous page of results (null in this case since this is the first page of results).
The "results" key contains the actual data objects I'd like to display in the OnDemandGrid.
How do I connect the "results" key data collection to the grid? Thank you for your help in advance.
The returned JSON ( collection: new Rest({target: '/api/events'?format=json'),}) ) looks like this:
{
"count":1411,
"next":"http://localhost/api/events/?format=json&page=2",
"previous":null,
"results": [
{"id":1,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
{"id":2,"event_type":"02","event_at":"2015-03-31T12:53:41Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
...
{"id":25,"event_type":"02","event_at":"2015-03-31T12:54:01Z","machine_id":1,"revs":4342,"color":5,"heads_info":"using http","tag":1,"hidden":false},
]
}
It looks like you're trying to use this service with dstore/Rest, but that has some specific expectations of the server request and response:
The response must report the list of items in one of the following ways:
Respond with a top-level array of items
Respond with an object with an items property whose value is an array of items
The response must report the total number of items in one of the following ways:
If the response is an object, you may include a total property in the object
Otherwise, you must include a Content-Range header (in the format X-Y/Z items, where the Z is of primary importance)
The request must support being informed of the range of items it should request out of the total result set via one of the following mechanisms:
start and count GET parameters (specified to the store instance via rangeStartParam and rangeCountParam)
Range headers (by setting useRangeHeaders: true)
Otherwise, by default, the store will pass a limit GET parameter in the format limit(count,start) (or just limit(count) if start is 0)
If your server can't fulfill these requirements (e.g. it sounds like it has quite different requirements regarding ranging, since it uses pages instead), you're going to need to think about extending/implementing a custom store.