I wanted to get the first 2 items from the AdAnalyticsV2 endpoint. As explained here you should be able to do this for any service by adding a count parameter to the query, but adding e.g. count=2 to the query doesn't seem to do anything. I still get the same amount items back as usual whenever I add it. Also, changing the start, so it just gets the next 10 items, results in the following error: StatusCodeError: 400 - {"serviceErrorCode":2,"message":"Setting a paging start value is not permitted","status":400}
Is pagination not available for the AdAnalyticsV2 endpoint?
There is a weird bug with pagination where if there are exactly 10 results and you didn't specify a count it was giving me that message. I set the count to 5000 and have had no problems.
Related
I am using the marketing API
I have an issue with the pagination, it seems like it ignores the start and count.
I am using the start and count query parameters and no matter what number I put in the count, I get a response with all the results
I followed this document for pagination:
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/concepts/pagination
I use this endpoint:
https://api.linkedin.com/v2/adAnalyticsV2
my parameters include:
start=0&count=10&q=statistics&timeGranularity=MONTHLY ....
in the response, I received 821 elements without any pagination. instead of 10 per page.
if I use the logic in the docs the values for start and count will not affect the results or the query
what am I doing wrong?
I don't want to use it without pagination and find out later that I missed records.
Thanks,
Roiy
I have used pagination to retrieve the posts of the organization, and its working for me
my api call is
api_url = "https://api.linkedin.com/v2/shares?q=owners&owners=urn%3Ali%3Aorganization%3A123456&sharesPerOwner=1000&count=100&start=0"
one thing importantly i noticed is this does not requires restli2.0 version(dont pass this in header)
I'm building an application which pulls down incident listings for my org via Pagerduty's REST API.
The GET /incidents endpoint does respond with more, offset, and other keys that are indicative of pagination being supported, and it does make intuitive sense on this endpoint, but I haven't been able to actually paginate these results:
Passing offset or limit as a query param returns a 403
Passing these in various forms in request headers just gets ignored entirely
Is there a way to paginate these results at all?
it might help to include the code you're using to make the request, or a curl request from the command line. Including pagination parameters shouldn't lead to a 403, so I'm thinking something else might be missing.
You should be able to paginate the lists using GET parameters, e.g
https://api.pagerduty.com/incidents?limit=20&offset=100
limit has a maximum value of 100, and limit + offset together must be less than 10,000. That might be why you were getting an error?
See here for additional details on the pagination parameters
Yes, it's possible to paginate the results.
After invoking the API method for the first time, you need to check the more response field value. If true, then you can call the API method again with an updated offset.
offset is related to the total results, and not the total pages.
The 403 error code response you're getting is most likely related to the user permissions and not with paginating results.
We have been using below end point to fetch the Instagram feeds
https://www.instagram.com/saintgobaingroup/?__a=1&max_id=
Later, for further feeds we use to fill the max_id parameter with last entry's id. It was working fine but now Instagram end point seems to have change the response format.
We are able to update the piece of code to match the response. However the max_id parameter seems to be not working now.
We are getting same 12 records even when we have more than 400 records. We are properly updating the max_id parameter like we use to do earlier. But we are unable to get further records only 12 records being getting repeated.
Any idea on this?
Note : As of now we're not focusing on using the Instagram API. We would like to get it done with end point ?__a=1
The answer doesn't work with ?__a=1, but it does get you pagination here: https://stackoverflow.com/a/49266320/929540
I'm searching for events at a particular place and also successfully retrieving all the events. But suppose I'm getting about 1500 events as "total_items" and the first page of response shows up the first 10 events.Then how could I reach to the remaining set of events, there isn't any "next page link".
And the most important question that are there any restrictions or upgradation plan for Eventful. Just because I was not able to find the required answers on their web portal. I'm posting it over here.
You are getting 10 events as default page size is 10 .If you want to change page size ,you can change it in your query.
http://api.eventful.com/rest/events/search?l=GREEN+BAY+WEST&page_size=100
In the above query it will return 100 events,you can get 100 events per page maximum.
If you want to go to next page,you can change page_number in your query.
I have around 53,00,000 documents in MarkLogic server and I am building a simple search application. User enters a search term and MarkLogic server searches that term in all the nodes in all the documents and returns the matching documents as the result. I have implemented a custom paging to show results per page. I am showing 10 results per page.
I am using search api for this as:-
import module namespace search="http://marklogic.com/appservices/search" at "/Marklogic/appservices/search/search.xqy";
declare variable $options:=
<options xmlns="http://marklogic.com/appservices/search">
<transform-results apply="raw"/>
</options>;
search:search($p, $options, $noRecFrom, 10)/search:result
where $p is the input from the user $noRecFrom is the number which indicates from where we have to show records. For example for page 1 $noRecFrom will be 1, for page 2 $noRecFrom will be 11, for page 3 $noRecFrom will be 21 and so on. For paging there are hyperlinks to go to First, Next, Prev and Last pages.
To calculate the total number of records returned I am using:-
for $x in search:search($p, $options)
return $x//#total;
While First, Next and Prev hyperlink works perfectly but if someone clicks Last the application stops responding and the query does not show any output. Is it due to the large number of documents in the database or I am implementing it wrongly.
Is there any efficient way for pagination in MarkLogic (for search:search) so that the user can go the Last page without delay in query result for such a large database ?
The way you've implemented it, you're running the search repeatedly in your for loop. And that would indeed be slow.
Instead, you should be calculating a $start parameter based on the #total and number of documents per page, and passing that in as an argument (I think it's the third one) to search:search.
I would also recommend making sure you can run in unfiltered mode. There is good information about optimizing for fast pagination (indexes, etc) on the developer site; the idea is to resolve queries out of indexes to give very good, accurate unfiltered performance.
If you do it that
There is a tutorial on paginated search at http://developer.marklogic.com/learn/2006-09-paginated-search
Once you have resolved the issues mentioned by cwhit above, if you still want to get to the last page of data in a faster manner, you could make your code smart enough to reverse the sort order and pull the correct offset of records.
Here's another tip:
To get better insight to what MarkLogic is doing with search:search, call
search:get-default-options()
to see the starting point for common search applications.