Newscatcherapi.Net 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Newscatcherapi.Net --version 2.1.0
                    
NuGet\Install-Package Newscatcherapi.Net -Version 2.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Newscatcherapi.Net" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Newscatcherapi.Net" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Newscatcherapi.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Newscatcherapi.Net --version 2.1.0
                    
#r "nuget: Newscatcherapi.Net, 2.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Newscatcherapi.Net@2.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Newscatcherapi.Net&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Newscatcherapi.Net&version=2.1.0
                    
Install as a Cake Tool

Newscatcherapi.Net - the C# library for the NewsCatcher News API V2

NewsCatcher is a data-as-a-service startup that has one main goal: to build the largest database of structured news articles published online. In other words, we're like Google for the news part of the web, which you can access as a source of data.

Some useful links:

This C# SDK is automatically generated by the Konfig:

  • API version: 1.0.1
  • SDK version: 2.1.0

<a name="frameworks-supported"></a>

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

<a name="dependencies"></a>

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

<a name="installation"></a>

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Newscatcherapi.Net.Api;
using Newscatcherapi.Net.Client;
using Newscatcherapi.Net.Model;

<a name="usage"></a>

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

<a name="getting-started"></a>

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Newscatcherapi.Net.Api;
using Newscatcherapi.Net.Client;
using Newscatcherapi.Net.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();

            // Configure custom BasePath if desired
            // config.BasePath = "https://api.newscatcherapi.com/v2";

            // Configure API key authorization: api_key
            config.ApiKey.Add("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("x-api-key", "Bearer");

            var apiInstance = new LatestHeadlinesApi(config);
            var lang = en;  // string | Specifies the languages of the search. For example: `en`. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional) 
            var notLang = "af";  // string | Inverse to the `lang` parameter  (optional) 
            var countries = "countries_example";  // string | Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, `US,CA,MX` or just `US`  (optional) 
            var notCountries = "notCountries_example";  // string | The inverse of the `countries` parameter.  (optional) 
            var topic = (Topic) "news";  // Topic? | Accepted values: `news`, `sport`, `tech`, `world`, `finance`, `politics`, `business`, `economics`, `entertainment`, `beauty`, `travel`, `music`, `food`, `science`, `gaming` The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional) 
            var sources = "sources_example";  // string | One or more news resources to filter your search. It should be the normal form of the URL, For example: `nytimes.com,theguardian.com`  (optional) 
            var notSources = "notSources_example";  // string | One or more sources to be excluded from the search. Comma-separated list. For example: `nytimes.com,cnn.com,wsj.com`  (optional) 
            var rankedOnly = true;  // bool? | Default: `True` Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals `999999`  (optional) 
            var pageSize = 56;  // int? | `[1:100]` How many articles to return per page.  (optional) 
            var page = 56;  // int? | The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional) 

            try
            {
                // Get Latest News Articles
                Model200ResponseLatest result = apiInstance.Get(lang, notLang, countries, notCountries, topic, sources, notSources, rankedOnly, pageSize, page);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling LatestHeadlinesApi.Get: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

<a name="documentation-for-api-endpoints"></a>

Documentation for API Endpoints

All URIs are relative to https://api.newscatcherapi.com/v2

Class Method HTTP request Description
LatestHeadlinesApi Get GET /latest_headlines Get Latest News Articles
LatestHeadlinesApi Post POST /latest_headlines Get Latest News Articles
SearchApi Get GET /search Search for specific news articles
SearchApi Post POST /search Search for specific news articles
SourcesApi Get GET /sources Get top news sources supported by NewsCatcher.
SourcesApi Post POST /sources Get top news sources supported by NewsCatcher.

<a name="documentation-for-models"></a>

Documentation for Models

<a name="documentation-for-authorization"></a>

Documentation for Authorization

<a name="api_key"></a>

api_key

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.0.13 490 10/14/2024
6.0.12 155 10/8/2024
6.0.11 158 9/3/2024
6.0.10 289 7/12/2024
6.0.9 142 7/10/2024
6.0.8 163 7/2/2024
6.0.7 160 6/18/2024
6.0.6 155 6/5/2024
6.0.5 214 4/30/2024
6.0.4 177 4/25/2024
6.0.3 153 4/19/2024
6.0.2 181 4/15/2024
6.0.1 150 4/4/2024
6.0.0 281 12/3/2023
2.1.0 350 2/21/2023
2.0.0 370 1/30/2023
1.1.0 358 1/30/2023
1.0.0 390 1/30/2023

Minor update