How to search GitHub API for followers between two values? - github-api

Something like this doesn't work:
https://api.github.com/search/users?q=followers:>2500+followers:<3000
Is there any way to do this, perhaps with the GraphQL API?

To get data between two values, you can use .. between the two values. See the link
https://api.github.com/search/users?q=followers:2501..2999

Related

Filter for multiple envelope custom_fields

We have added 2 required custom_fields to our Envelopes that we create through DocuSign.
Now we are trying to fetch these Envelopes and filter them by the value of said Custom fields.
This is working well if we are filtering for 1 value, like in this example:
https://demo.docusign.net/restapi/v2.1/accounts/ACCOUNT_ID_NUMBER/envelopes?status=sent&custom_field=FIELD1%3DVALUE1
Like I mentioned, this works, but we are struggeling to find a way to filter for 2 custom_fields.
We tried some of the usual approaches by using square brackets or using the 'AND' and 'OR' keywords between the filter queries, but none of them seem to be working.
Anyone has an Idea how this could be solved?
Unfortunately the product doesn't support this currently.
Therefore you'll need to make two API calls, one for each custom field. Then your application can compute the intersection of the response envelope ID sets.

Can we post an array of objects with knex?

I'm using knex with node and I was thinking of making a field in the migration that would take an array of objects. I know simple stuff like
.string("bla")
.notNullable()
and so on, looking in the documentation can't seem to find it
wanting something like
.array_of_objects //field name
knex.schema.createTable('users', function (table) {
table.increments();
table.string('name');
table.timestamps();
//example
table.array
})
With table.specificType you can create which ever type of database column you like. You need to check from your database, which kind of columns it supports.
It would make easier to answer the question if you could tell what kind of SQL queries you are after. To be able to use knex, you need to know SQL. Knex will never abstract SQL away.
If you are looking for a database library for node.js that abstracts SQL away you might like to checkout sequelize.
Thanks for the post with the specificType. From what I saw PG didn't have an array of objects field, but did have an array of strings field. I ended up taking my array of objects and separating it into two string arrays one named keys and the other values. I stored both of those arrays in the database. Then when I did a get request I took the two arrays joined them together into an array of objects with some javascript tacking. Seems to do the trick.

get list of all view names in couchdb

Is it possible to get a list of all the views of a database in couchdb using [dscape/nano][1]? The closest I can get with just curl request is this:
http://URL/DBNAME/_all_docs?key=_design/views&include_docs=true.
The above returns all the views including the javascript functions. But I would like to extract only the view names.
In newer CouchDB versions, you can use "_design_docs" to only list the views:
GET /dbname/_design_docs
This will get you the wanted list much faster than if you'd have to go through all the docs (_all_docs).
See 1.3.3. /{db}/_design_docs of the official documentation.
Note: The documentation as of today states this is new in CouchDB version 2.2, but I successfully tested it on 2.1.
Unfortunately the only possible way of doing this is by extracting view names from the result of the query you've included in your question. Futon is doing it this way when populating drop-down list of views, so I think it is safe to assume this is the only solution.
You may also want to change your query to the following to include all design documents, instead of just the one named views:
GET /dbname/_all_docs?startkey="_design/"&endkey="_design0"&include_docs=true

How do I get the most popular tags?

How do I get the most popular tags from Instagram API? I searched the API, but didn't find a way to retrieve this data. This website gets it, but how?
The question is old, but for others also struggling the same problem, as Sebastien mentioned there is no such query. However I have been recently needing same functionality and came down idea that small traversal pretty much solves the problem.
Instagram doesn't respond you a list of tags starting with just one letter.
Example:
https://api.instagram.com/v1/tags/search?q=a
This URL returns just one element, which is "a". However if you send a request containing two characters like
https://api.instagram.com/v1/tags/search?q=aa
then you'll end up with the most popular tags starting on "aa"
Afterwards you can simply traverse your desired alphabet in O(N^2) time and by joining responses you'll end up with a list of most popular tags.
Length in case of English(Latin) alphabet would be 26^2 = 676
Though you shouldn't probably try getting any more tags as the limit is still 5,000 requests and 26^3 would go for 17576.
foreach(character in 'a'...'
{
foreach(character in 'a'...'z')
{
Send hashtag request 'aa'...'az'...'zz'
Get json and merge with previous array
}
}
Sort final array by [media_count]
Alternate approach would be to parse some huge dictionary (wikipedia dump for example) and sort out top 5000 most common prefixes and try querying them.
I don't think the API supports that query. What you can do is check this popular media endpoint and deduce popular tags from there:
http://instagram.com/developer/endpoints/media/#get_media_popular
The website you mention could be using multiple Real-time subscriptions and generate that list of popular tags by consolidatingthe harvested information. That wouldbe my guess.
I think the best thing is to ask them directly.

Looking up types from Freebase

I am trying to find a list of relevant types to a certain string from Freebase, lets say for example i enter Jordan, then i will have a list with types country, person, athlete .. etc.
I have found several ways for the query, for example:
First Query
trying to get the JSON fails, using:
$.getJSON('http://api.freebase.com/api/service/search?query=jordan',function (data) {
console.log(data);
});
There is another query that gives me better result, as i only get the types here but i also cannot get the JSON file from it.
Will appreciate any help.
Your problem has probably less to do with freebase and more to do the fact that you can't do cross domain http requests. You are requesting data from api.freebase.com but you are probably hosting this page in another domain.
You can use the JSONP mechanism to circumvent that restriction, here is some documentation:
http://api.jquery.com/jQuery.getJSON/
Read the section JSONP.
Another couple of points:
Are you trying to search for all entities that somehow match the word "jordan" or are you looking for exactly all the entities that are named "jordan" ? Your best bet is to use the /search API instead of /mqlread which is for structured database queries.
You are also using the legacy API that is deprecated. Here is some docs on the new API:
http://wiki.freebase.com/wiki/API
Here's how your request will look (note that you 'll need an API key for production):
https://www.googleapis.com/freebase/v1/search?query=jordan&mql_output=[{%22name%22%20:%20null,%22type%22:[]}]

Resources