Ballerina Central will undergo scheduled maintenance on Wednesday, August 06, from 00:30 AM to 01:30 AM UTC. During this time, Ballerina Central login and sign up will be temporarily disabled. We appreciate your patience as we work to improve your experience. For more information, reach out to contact@ballerina.io

ballerinax/newsapi Ballerina library

1.5.1

Overview

This is a generated connector for News API v2.0.0 OpenAPI specification.

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

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: about 2 years ago

Version: 1.5.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 2127

Current verison: 320


Weekly downloads


Source repository


Keywords

Lifestyle & Entertainment/News & Lifestyle

Cost/Freemium


Contributors