Usposabljanje
Vodeno učenje
Microsoft Search fundamentals - Training
Learn about Microsoft Search including where users can search, the answers and results they'll see, and how you can tailor the search experience for your organization.
Ta brskalnik ni več podprt.
Izvedite nadgradnjo na Microsoft Edge, če želite izkoristiti vse prednosti najnovejših funkcij, varnostnih posodobitev in tehnične podpore.
Use Bing Video Search API to search the Web for videos that matches the user's request.
It's easy. If you have your subscription key, just send an HTTP GET request to the following endpoint:
https://api.bing.microsoft.com/v7.0/videos/search
Here's a cURL example that shows you how to call the endpoint using your subscription key. Change the q query parameter to search for whatever videos you'd like.
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies
Although that's all you need to do to search the Web, Bing suggests you include a couple of other headers to provide a better search experience for your user. Those headers include:
The more information you can provide Bing, the better the search experience will be for your users. To learn more about these headers, see Request headers.
Here's a cURL example that includes these headers.
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" -H "X-MSEdge-ClientID: 00B4230B74496E7A13CC2C1475056FF4" -H "X-MSEdge-ClientIP: 11.22.33.44" -H "X-Search-Location: lat:55;long:-111;re:22" -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies
Bing returns a couple of headers you should capture.
To learn more about these headers, see Response headers.
Here's a cURL call that returns the response headers. If you want to remove the response data so you can see only the headers, include the -o nul
parameter.
curl -D - -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies
The only query parameter that you must pass is the q parameter, which you set to the user's query string. You must URL-encode the user's query string and all query parameter values that you pass.
The API supports a number of query parameters that you can pass in your request. Here's a list of the ones you're most likely to use.
To learn more about these parameters and other parameters that you may specify, see Query parameters.
Here's a cURL example that includes these query parameters.
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies&mkt=en-us&safeSearch=moderate&count=10&offset=0
For information about query parameters that you can use to filter the search results, see Filter the videos that Bing returns.
When you query the Web, Bing returns all relevant videos that it finds. But what if you're only interested in videos that you can embed in your webpage or videos that are free? Simple, just use one or more of the following query parameters to filter the types of videos that you want. For more details about these parameters and others, see Filter query parameters.
The following example shows how to get embeddable videos that Bing discovered in the past week that are free.
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies&embedded=true&freshness=week&pricing=free&mkt=en-us
To get videos from a specific domain, use the site: query operator in the query string. The response may contain results from other sites depending on the number of relevant results found on the specified site.
The following example gets sailing videos found on contososailing.com.
curl -H "Ocp-Apim-Subscription-Key: <yourkeygoeshere>" https://api.bing.microsoft.com/v7.0/videos/search?q=sailing+dinghies+site%3Acontososailing.com&mkt=en-us
Opomba
Because the site:
operator might include adult content regardless of the safeSearch setting, only use site:
if you're aware of the content on the domain.
The safeSearch query parameter lets you filter videos for adult content.
You may set the safeSearch parameter to one of the following values:
The default is Moderate. If you specify Off, Bing ignores it and will use Moderate.
Usposabljanje
Vodeno učenje
Microsoft Search fundamentals - Training
Learn about Microsoft Search including where users can search, the answers and results they'll see, and how you can tailor the search experience for your organization.