ballerinax/newsapi Ballerina library

1.5.2

Overview

The News API v2.0.0 connector(https://newsapi.org/docs) OpenAPI specification.

News API used to fetch news(articles, headlines and sources) from news sources and blogs across the web.

Key Features

  • Programmatic access to create and manage resources via REST API
  • Manage user accounts and profiles
  • Secure authentication with API key or OAuth support

Prerequisites

Before using this connector in your Ballerina application, complete the following:

Quickstart

Step 1: Import connector

Import the ballerinax/newsapi module into the Ballerina project.

Copy
import ballerinax/newsapi;

Step 2: Create a new connector instance

Copy
newsapi:ApiKeysConfig config = {
    apiKey : "<your apiKey>"
};

newsapi:Client myclient = check new newsapi:Client(config, {}, "https://newsapi.org/v2");

Step 3: Invoke connector operation

  1. You can get top headlines as follows with listTopHeadlines method by passing country as a parameter.
    Copy
    newsapi:WSNewsTopHeadlineResponse result = check myclient->listTopHeadlines(country="us");
  2. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/newsapi;Copy

Other versions

See more...

Metadata

Released date: 3 days ago

Version: 1.5.2

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 2196

Current verison: 0


Weekly downloads


Source repository


Keywords

Type/Connector

Vendor/NewsAPI

Area/Productivity & Collaboration

Lifestyle & Entertainment/News & Lifestyle

Cost/Freemium


Contributors