how to get all set of results from google custom search api in REST mode i,e. through url? - google-custom-search

in google custom search REST, when i set start parameter to value more than 100 its not returning results i,e. start=101 its returning 400 status.
here is request to custom search :
https://www.googleapis.com/customsearch/v1?key=AIzaSyDKVKBFRcdMnpmEtYNIJSE4kPw22O3yIpY&cx=004627592641946060093:sk0jmzk2vzc&q="+query+"&start=101"
the totalResults is 300 but it is not returning results for this request

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.

What is the proper way to format a GET request to retrieve all media items of the Instagram user "self"?

Looking at https://www.instagram.com/developer/endpoints/users/ I have gathered that calling https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN will return "the most recent media published by the owner of the access_token."
In sandbox mode I understand that I will receive a maximum of 20 media items from this call. I also realize that the response code has a pagination object that I can use to retrieve up to 20 more media items (see below)
"pagination": {
"next_max_tag_id": "1387272337517",
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead",
"next_max_id": "1387272337517",
"next_min_id": "1387272345517",
"min_tag_id": "1387272345517",
"next_url": "https://api.instagram.com/v1/tags/cats/media/recent?access_token=xxx&max_tag_id=1387272337517"
}
These are the listed parameters of this Request.
PARAMETERS
ACCESS_TOKEN A valid access token.
MAX_ID Return media earlier than this max_id.
MIN_ID Return media later than this min_id.
COUNT Count of media to return.
My question is: Is there a way to structure my GET request in a way that returns all media items from a single call? I understand that this is not possible in sandbox mode, given a user with more than 20 media items. If possible please provide a detailed explanation of the COUNT parameter.
I imagine a possible GET request would look like https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN?COUNT=X
Thank you. <3
When you go live mode you can use the count= param to get more than 20 in one API call, however I have noticed that count=33 is the maximum you can get for this API call, even if you anything more than 33, it only returns 33.
You still have to use the pagination in JSON response to get the next set of media items, easiest way is to use the pagination.next_url to make API call and get next set of media items

What input is the API expecting?

I need to use this API : https://adresse.data.gouv.fr/api/
and i want to know how can i know the input is this API expecting.
The api you need to request to is
http://api-adresse.data.gouv.fr/search/
If you want to do a full text search you have to pass in a q request param in the url like
http://api-adresse.data.gouv.fr/search/?q=YOUR_TEXT
If you want to limit the response from the api call to 10 records, you can use limit param
http://api-adresse.data.gouv.fr/search/?q=YOUR_TEXT&limit=10
Go through the documents to see a complete list of input params that can be passed in the api call.
You can use Postman in order to run or test api.

Is there a limit to start option in google custom api CSE list?

using google custom API, I have a problem when I try to get results of more than 100.
I got an error as shown below. The code I am using is below:
res = service.cse().list(
q='lectures',
cx='my custom search engine id',
num=10,
start=100,
).execute()
I want to extract several pages every day.I got this error.
HttpError 400 when requesting .. "Invalid Value">
if I make the start=90 or less it works!
From the documentation for the Google Custom Search API:
https://developers.google.com/custom-search/v1/using_rest
This role is not present if the current results are the last page.
Note: This API returns up to the first 100 results only.

Google custom search REST number of results (num field)

I'm trying to figure out how to force google custom search to give me back 20 results per page.
I've tried to send this REST request configuring my new Custom Search Engine to:
Standard edition: Free, ads are required on results pages.
https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=20
IT NOT WORKS!
but
https://www.googleapis.com/customsearch/v1?key=AIzaSyCgGuZie_Xo-hOECNXOTKp5Yk7deryqro8&cx=015864032944730029962:5ipe0q27hgy&q=test&alt=json&num=10
IT WORKS!
But reading documentation at
https://developers.google.com/custom-search/docs/xml_results#numsp
it says that:
Optional. The num parameter identifies the number of search results to return.
The default num value is 10, and the maximum value is 20. If you request more than 20 results, only 20 results will be returned.
Note: If the total number of search results is less than the requested number of results, all available search results will be returned.
Someone has experienced this problem?
PS: I've tried also to send that REST request configuring my new Custom Search Engine to:
Site Search: Starts at $100 per year, ads are optional on results pages.
But nothing has changed no way to obtain 20 results in a request/page
This documentation url has descriptions of each parameter. It also says num is restricted to integers between 1 and 10, inclusive.
https://developers.google.com/custom-search/v1/using_rest#query-params