I try to find in youtube API (jsonp), if I can get in 1 query uploads videos from multiple users.
for 1 users I can use this query string:
http://gdata.youtube.com/feeds/users/myUsername/uploads?alt=json-in-script&callback=?&max-results=20'
but I need something like this:
http://gdata.youtube.com/feeds/users/myUsername+myUsername1+myUsername2/uploads?alt=json ...
myUsername+myUsername1+myUsername2
or Maybe I can use the search query format :
https://gdata.youtube.com/feeds/api/videos?alt=json&q=
and to use something like :
q=from:myUsername1+from:myUsername2
Or if exist any another way to grab this info.
I appreciate any help, thanks!
It's not possible to ask for multiple users for the list of uploads. Instead you can trying using the search api and limiting it to only the users you want.
By including #username you can restrict the search to a user name. Try this link to search for #youtube #googledevelopers
You can try this in as part of the query parameter in the YouTube Data API.
It's not possible to do that in a single YouTube Data API query. You can only use a single channel/user as the value for the author=USER query parameter, or when specifying the feeds/api/users/USER URL.
Related
I'm running a local server playing around with an API using Django. I have a model called 'Users' populated with a few objects, and am using DefaultRouter.
I want to know what the URL would be if I were to DELETE a specific object from this model. For example, if I wanted to GET a user with an ID of 1 in this model, the URL would be: "localhost:8000/Users/1/". What would the equivalent be to DELETE this user?
I found an explanation of this on the REST API website (below), however, I don't understand what any of the syntaxes means.
What is {prefix}, {url_path}, {lookup} and [.format]? If anyone could provide an example of what this might be using a localhost that would be really helpful.
Thanks
Let us take an example of an API (URL) to update book data with id (pk) being 10. It would look something like this:
URL: http://www.example.com/api/v1/book/10/
Method: PUT/PATCH
With some data associated.
If you want to delete you just need to change method to DELETE instead of put or patch.
Regarding your second question lets compare the url with the parameters.
prefix: http://www.example.com/api/v1/book
lookup: 10
format: It specifies what type of data do you expect when you hit the API. Generally it is considered to be json.
url_path: In general, every thing after look up except query string is considered to be url_path.
I have a table with latitude and longitudes. I want to pull weather data from an API (openweathermap.org) using the coordinates from my table. Any help would be appreciated. I don't have much experience with queries.
let
Source = Json.Document(Web.Contents("api.openweathermap.org/data/2.5/weather?lat=49.57&lon=-121.79&appid=xxxxx"))
in
Source
Your API call should contain "https://" in the web address like so:
https://api.openweathermap.org/data/2.5/weather?lat=49.57&lon=-121.79&appid=xxxxx
Also you might already be aware, but it also goes without saying you need to replace XXXXX with your actual appid
Using the MediaWiki API I have a query that returns the results I want:
https://en.wikipedia.org/w/api.php?action=query&list=allpages&apfrom=Apple&aplimit=5
How can I modify it to also include the URL for each of the pages that are returned?
I tried adding the "info" property and "url" info, but it does not return additional information:
https://en.wikipedia.org/w/api.php?action=query&list=allpages&apfrom=Apple&aplimit=5&prop=info&inprop=url
You need to move the parameters you use to get the result to a generator instead of a list and then use prop=info and inprop=url in the query. Like this:
https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info&generator=allpages&inprop=url&gapfrom=Apple&gaplimit=5
I've been looking for a way to query the wikipedia api based on a search string for a list of articles with the following properties:
Title
Snippet/Description
One or more images related to the article.
I also have to make the query using jsonp.
I've tried using the list=search parameter
http://en.wikipedia.org/w/api.php?action=query&list=search&prop=images&format=json&srsearch=test&srnamespace=0&srprop=snippet&srlimit=10&imlimit=1
But it seems to ignore the prop=images, I've also tried variations using the prop=imageinfo and prop=pageimages. But they all give me the same result as just using the list=search.
I've also tried action=opensearch
http://en.wikipedia.org/w/api.php?action=opensearch&search=test&limit=10&format=xml
Which gives me exactly what I want when i set format=xml, but returns a simple array of page titles when using format=json and therefore fails because of the jsonp requirement.
Is there another approach to doing this? I'd really like to solve this in a single request rather than make the first search request and then a second request for the images using titles=x|y|z
As Bergi suggested, using generators is the way to go here. Specifically what I would do:
use list=search as a generator, to get the list of articles
use prop=pageimages to get a representative image for each article
use prop=extracts to get a description for each article
The whole query could look like this:
http://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrsearch=test&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max
I've tried using the list=search parameter, but it seems to ignore the prop=images
If you want to retrieve any properties, you need to specify a list of pages for which you want to get these; e.g. by using the titles=, pageids=, or revids= parameters. You didn't send any, so you did not get a result for the prop=images.
If you did use api.php?action=query&list=search&srsearch=test&prop=images&titles=test you would have gotten the search results for test and the images of the Test page.
You can however also use the collection that the list query generates for your property query, using the list module as a generator. The query would look like
api.php?action=query&generator=search&gsrsearch=test&gsrnamespace=0&gsrprop=snippet&prop=images. Unfortunately, it does not yield the attributes that the list contained, but only used the pageids for a basic property query.
Using two queries is probably the way to go. Btw, I'd recommend to use the pageimages property, it will likely give you the best results.
I've been looking through the different threads on the Facebook Graph API and displaying the results via JSON. The examples are great but I only want to output the info for a particular album not loop through various results.
Here is a link to the Coca-Cola Wall Photos album. https://graph.facebook.com/99394368305
What I would like to do is display the Name of the Album and the Link.
Any help is much appreciated!
You can choose only the fields you want by specifying the fields query parameter:
https://graph.facebook.com/99394368305/?fields=name,link
From http://developers.facebook.com/docs/reference/api/#reading:
Selection
By default, most object properties are returned when you make a query. You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture
You can also request multiple objects in a single query using the "ids" query parameter. For example, the URL https://graph.facebook.com?ids=arjun,vernal returns both profiles in the same response.