Mendeley search by query parameters - mendeley

Mendeley has a Catalog Search -> Search by query API that looks like the following: curl 'https://api.mendeley.com/search/catalog?query=polar+bears&limit=3' ...
The API Reference documentation says: "Retrieve documents which match general query terms."
I am wondering what general query terms (besides 'query=xxx' and 'limit=y') are available. I tried including some of the returned fields as parameters, e.g. year=2002, which was seemingly ignored, and title=xxx, which provoked the error: "Invalid parameters supplied"

It's all documented on the Swagger page.
You can use title, and you can also search by year using min_year and max_year.

Related

How to populate a search template parameter from a query string parameters in the SumoLogic user interface

Using the SumoLogic Search Templates with the tourl operator combined with the ability to Use_a_URL_to_Run_a_Search
I would like to launch a search that sets the search parameters via query string arguments. I've been unable to find documentation on this ability, and it doesn't seem supported.
It seems my only option would be to create something custom that uses the API directly to get the desired behavior.
Anyone else tried this or have advice?
It is not exactly what you are asking for but have you considered just using the share url feature? This properly populates parameters prefilled and is much easier to construct to boot.
https://help.sumologic.com/Search/Get-Started-with-Search/Search-Basics/Share-a-Link-to-a-Search

How to specify a language using Insight API for Twitter from IBM Bluemix Platform

I'm starting to use Insight API for Twitter from IBM Bluemix.
It's hard to find supporting resource for using this. So far I am using CURL and specifically formed URL to query the API service, and the service returns results in JSON format.
Here's an example of the URL I used with CURL to search for some tweets with the API:
https://(my seucrity key)#cdeservice.mybluemix.net:443/api/v1/messages/search?q=$MSFT%28posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z%29&size=20
This URL returns a JSON object with tweets with keyword #MSFT, and between the time frame of 2016-1-1 to 2016-9-1, only return 20 tweets.
I would like to add to that link by specifying a language for the tweet to search for, so far I come up empty. Can you please help me ?
I have tried adding the following to the URL and did not do anything:
lang=EN, lang="en"
lang:en, lang:EN
Thanks.
The syntax is lang:en and you need to make sure to include it as part of your query.
I created the following query based on the one you provided in your question:
https://username:password#cdeservice.mybluemix.net:443/api/v1/messages/search?q=(%24MSFT%20AND%20posted%3A2016-01-01T00%3A00%3A00Z%2C2016-09-01T00%3A00%3A00Z%20AND%20lang%3Aen)&size=20
The unencoded query is
($MSFT AND posted:2016-01-01T00:00:00Z,2016-09-01T00:00:00Z AND lang:en)
You can find documentation here.
But in this link you can find more details on the syntax, which is:
/api/v1/messages/search?q=QUERY&size=NUMBER&from=NUMBER

Search multiple keywords in Youtube GData Youtube class

The Youtube API document says that multiple keywords can be searched during video fetch as per the below link.
https://developers.google.com/youtube/2.0/reference#Searching_for_videos
The below link gives some examples for the same. The example provided for the "q" parameter says that we can use NOT (-) and OR (|) operator in the search:
https://developers.google.com/youtube/2.0/reference#qsp
Example: q=boating%7Csailing does a search for either boating or sailing.
I am able to understand these points. My question is I am using ZendGData library in Zend Framework 2 to search the videos. I am not sure how to provide multiple keywords for the search.
$yt = new ZendGData\YouTube();
$query = $yt->newVideoQuery();
All the combinations that I tried is provided below. None of them works.
$query->setQuery("french,tamil");
$query->setQuery("french|tamil");
$query->setQuery("french%7Ctamil");
$query->setQuery("french or tamil");
Note: The docs says to use url encode so that the pipe symbol is encoded. That's why I treid %7C in the search.
The URL generated by the ZendGData class is:
https://gdata.youtube.com/feeds/api/videos?q=french|tamil&start-index=58&max-results=50&safeSearch=none&orderby=viewCount&format=5&v=2
This does not fetch the videos with keyword "tamil". All the videos are from the first keyword only.
Please point me in the correct direction.
Or this with a simple space. Tested it and it found all the keywords https://gdata.youtube.com/feeds/api/videos?q=french%20tamil&start-index=1&max-results=50&safeSearch=none&orderby=viewCount&format=5&v=2
So try this $query->setQuery("french tamil"); or $query->setQuery(urlencode(("french tamil"));
Also your start-index looks strange and should that not be start-index=1

facebook graph api returns error 2500 when there are commas in the id url

I'm attempting to retrieve the "shares" graph data for a number of pages in JSON format. I suspect that the errors I am encountering stem from the fact that some of the URLs have commas in them, and are being parsed as an attempt to pass multiple ids.
Returns graph data.
https://graph.facebook.com/?ids=http://celebritybabies.people.com/2012/08/23/backstreet-boys-howie-dorough-expecting-second-son/
Returns error 2500 "Cannot specify an empty identifier"
https://graph.facebook.com/?ids=http://www.people.com/people/article/0,,20624518,00.html
Encode the commas, still returns 2500
https://graph.facebook.com/?ids=http://www.people.com.people.article/0%2C%2C20624518%2C00.html
There doesn't seem to a way around it other than to use the normal inspection
http://graph.facebook.com/http://www.people.com/people/article/0,,20624518,00.html
You may have to file a bug at http://developers.facebook.com/bugs though I feel as the answer would most likely be "Status by design".
You could try using FQL instead, querying the link_stat table:
SELECT url, normalized_url, share_count, comments_fbid FROM link_stat
WHERE url = 'http://www.people.com/people/article/0,,20624518,00.html'
(See result in Graph API Explorer.) You can also use WHERE url IN ("…", "…", …) to check multiple URLs at once.
This also returns a comments_fbid of 10151022112466453, and that one you can look up via the API, https://graph.facebook.com/10151022112466453
Maybe this can work as a workaround, until Facebook fixes this problem.

Different result when using GET/POST in elastic search

I am experimenting with elastic search via the Elastic Search Head plugin.
The results are as expected when I submit a query via POST.
However when I try the same query using GET, I always get back all values in the index.
So : how to pass the query to the elastic search server via GET so I can use the search string in an URL?
If you send a GET the body is probably not even sent to elasticsearch, so you are basically sending no query to the _search endpoint, which is why you are getting everything back (of course only the first 10 results based on the default size parameter).
Have a look at the URI request, which allows you to send basic queries using the q parameter within the URI. You can use the Lucene query syntax and specify some other parameters listed in the linked page. If you then want to execute more advanced queries, you might want to express them as JSON queries in order to get all the benefits of the elasticsearch Query DSL, but you'd need to provide them as body of the request.
UPDATE
Looking deeper at the elasticsearch head plugin, the query is not sent as the request body when you select the GET method but within the URL itself and without specifying the name for the parameter, like this:
http://localhost:9200/_search&{"query":{"term":{"text":"john"}}}
That is probably a bug in the plugin itself and elasticsearch can't find the query, that's why you get all the results back. That means that only the POST method works while sending queries with elasticsearch head.
Elasticsearch allows to use both GET and POST for executing queries. If you use GET you can either send the query as body or use the source parameter like this:
http://localhost:9200/_search?source={"query":{"term":{"text":"john"}}}

Resources