ballerinax/nytimes.archive Ballerina library
This is a generated connector for New York Times Archive API v1.0.0 OpenAPI specification. With the New York Times Archive API you can get all NYTimes article metadata for a given month. The Archive API returns an array of NYT articles for a given month, going back to 1851. Its response fields are the same as the Article Search API. The Archive API is very useful if you want to build your own database of NYT article metadata. You simply pass the API the year and month and it returns all articles for that month. The response size can be large (~20mb).
Before using this connector in your Ballerina application, complete the following:
- Create NYTimes developer account
- Obtain tokens
To use the New York Times TimesTags connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the
ballerinax/nytimes.archive module into the Ballerina project.
Step 2: Create a new connector instance
archive:ApiKeysConfig with the API key obtained, and initialize the connector with it.
Step 3: Invoke connector operation
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example on how to get all article metadata for a given month and year using the connector.
Get all article metadata for a given month and year
bal runcommand to compile and run the Ballerina program.
Released date: 10 months ago
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Current verison: 0