Search for Facebook public events - facebook

from the facebook documentation I know that
https://graph.facebook.com/search?q=conference&type=event
will perform a search of the word "conference" in the name and description of all public events.
is it possible to search for ALL the events without specifying the "query" parameter? Basically I don't want to limit the search to a keyword, I want to get ALL the public events (of course I will limit the research using the location field).
Also is there any list of possible categories I can use for searching between events? Using query sets a limitation in particular for the language (in different countries I have to search for different keywords,instead with a category I would fix this problem).
thanks a lot
Claus

You need to specify a q (query) parameter, but you can use the fields parameter to specify the fields in which you're searching. You may be able to achieve what you're trying to do by using this parameter.
See https://developers.facebook.com/docs/reference/api/#searching for more info.

Related

What is the correct format of the query for Search Requests to Spotify's Web API

I want to send search requests to Spotify's Web API. They have a search endpoint described in their docs. The URL query requires two parameters:
type of the searched item (i.e. album or track)
q which is the actual search query
The format of q is not clear to me. I can just enter search terms. For example if I want to find the song 'As It Was' from 'Harry Styles' I can just enter As It Was Harry Styles and the first returned item is the correct song. So far so good. But the description for q states that:
You can narrow down your search using field filters. The available filters are album, artist, track, year, upc, tag:hipster, tag:new, isrc, and genre. Each field filter only applies to certain result types.
They even provide an example:
remaster%20track:Doxy%20artist:Miles%20Davis
Using filters seems much more secure and better to me than just enter any terms into q. Especially, because for the items I search for, I will always have the title and the artist. But the problem is, I always receive empty responses. Even with the provided example query (and yes, that song exists, I looked it up (you can use literally the example query in the search interface of your Spotify app)).
So how do I use these filters?
What is this remaster in the begin? Just another search term?
Has anybody some experience with this and can help?
Unfortunately, I could not find anything on the web describing the query in more detail.

How can I specify multiple languages when sending a GET request to GitHub search API

I wonder how can I send a GET request to GitHub search API, specifically https://api.github.com/search/repositories and make the query to include several languages instead of one.
Here's my current query.
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala&sort=stars&order=desc&per_page=10
I have tried doing something like this but it didn't work as well
https://api.github.com/search/repositories?q=stars:%3E=1000+language:[scala, java]&sort=stars&order=desc&per_page=10
Thanks for your help
You need to pass in multiple language: element for being able to pass multiple languages to the query as per the doc.
For your specific case, the query would be :
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala+language:java&sort=stars&order=desc
with pagination applied it would be :
https://api.github.com/search/repositories?q=stars:%3E=1000+language:scala+language:java&sort=stars&order=desc&per_page=10
However, with pagination applied your search results will be limited in the browser.

What is the difference between fields and params in the Facebook Marketing API?

Documentation and Code Sample
In the documentation above there are only two parameters.
However, in the code example they are using fields as parameters.
I tried searching the docs but I'm still unclear on how fields and params are different.
Are they completely interchangeable or are there specific times to use each?
I tried searching the docs but I'm still unclear on how fields and params are different. Are they completely interchangeable or are there specific times to use each?
Fields are the specific data elements you can request about an object.
A user’s e-mail address, a post’s message, a page’s cover photo – those are fields.
Parameters allow you to limit the selection of data, based on specific criteria.
You request a page’s feed, but you only want posts from a specific time frame - then you use parameters like since and until, for example.
If you are familiar with basic SQL, you could use this as an analogy: Fields would be the column names you specify after SELECT; Parameters would be the WHERE clause.
I reached out to Facebook Support and this was their answer:
Parameters are inputs to an API that specify constraints on the range
of data that will be returned (time ranges, specific ids etc.). Fields
are what are returned by the API, if you want specific fields to be
returned, these can be specified by adding something like
"fields=id,name..." to an API.
Parameters and fields are not interchangeable.

REST Field filter use

I'm designing a RESTful API and I'm asking myself question about the filter field.
On my gets queries I want the user to be able to select the fields he want to get in the response. I was pretty sure that it would be the field filter jobs to give me the requested field but, after some reshearch, I found that most of the time it's used to add criteria on the fields, as a IF. Is it the user that needs to make show or hide the fields ans the Api return the full ressource everytime ?
I got an other question which is about the URI representation of such filter. Should it be something like /foo?fields=[bar1,bar2] ?
Thanks
It's not common to have a resource where you can specify what fields you want returned, by default all fields will get returned. If your resource has a lot of fields or some fields have really big values, it can be a good idea to have a way to specify which fields you want returned.
In REST there are no strict rules about how you should design your URLs for filters. It is indeed common to use GET parameters because they can be optional and don't have to be in any specific order. Your proposal of /foo?fields=[bar1,bar2] seems fine, however i would personally leave off the brackets.
Google Compute Engine API uses the 'fields' request parameter (see the documentation). The syntax is flexible enough to let user select/restrict even the nested elements. You may find it useful.
Yoga is a framework that allows you to deploy your own REST API's with selectable fields. This can reduce roundtrips to the server, and improve performance.

What is the difference between the QueryParser and the API?

On step 3 of this tutorial the author writes:
I personally would use the QueryParser when the search string is supplied by the user, and I’d use directly the API when the query is generated by your code.
Are there any benefits of using one over the other or is it just personal preference?
It's like the link says, if you want to allow users to enter custom searches as text string (i.e Name:matt, Age:[10 TO 80] use the QueryParser.
However if you only need to allow pre-defined queries, you can create them directly in your code.
So it depends what sort of queries you are using and how they are made, by the user, pre-defined etc