Autocompletes
Show me this endpoint for

About

The autocompletes endpoint a string of characters provided to it, and then returns suggested terms that are the most likely full words or strings. The terms returned by the News API are based on parameters the type parameters you can see below.

For example, if you provide the autocompletes endpoint with the term New York C and select the type dbpedia_resources, the API will return links to the DBpedia resources New_York_City, New_York_City_Subway, New_York_City_Police_Department, and so on.

Parameters

Name Type Description Notes
type string This parameter is used for defining the type of autocompletes. [enum: source_names, source_domains, entity_types, dbpedia_resources]
term string This parameter is used for finding autocomplete objects that contain the specified value.
language string This parameter is used for autocompletes whose language is the specified value. It supports ISO 639-1 language codes. [optional] [default to en] [enum: en, de, fr, it, es, pt]
perPage int? This parameter is used for specifying number of items in each page. [optional] [default to 3]

Return type

Autocompletes

Example

using System;
using System.Diagnostics;
using Aylien.NewsApi.Api;
using Aylien.NewsApi.Client;
using Aylien.NewsApi.Model;

namespace Example
{
    public class ListAutocompletesExample
    {
        public void main()
        {
            // Configure API key authorization: app_id
            Configuration.Default.ApiKey.Add("X-AYLIEN-NewsAPI-Application-ID", "YOUR_APP_ID");

            // Configure API key authorization: app_key
            Configuration.Default.ApiKey.Add("X-AYLIEN-NewsAPI-Application-Key", "YOUR_APP_KEY");

            var apiInstance = new DefaultApi();

            var type = "dbpedia_resources";
            var term = "obam";
            var language = "en";
            var perPage = 7;

            try
            {
                // List autocompletes
                Autocompletes result = apiInstance.ListAutocompletes(
                    type: type,
                    term: term,
                    language: language,
                    perPage: perPage
                );
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DefaultApi.ListAutocompletes: " + e.Message );
            }
        }
    }
}