With the NewsAPI API, you can build apps that:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
newsapi: {
type: "app",
app: "newsapi",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://newsapi.org/v2/top-headlines`,
headers: {
Authorization: `Bearer ${this.newsapi.$auth.oauth_access_token}`,
},
params: {
country: `us`,
category: `business`,
apiKey: `${this.newsapi.$auth.api_key}`,
},
})
},
})
NewsAPI uses API keys for authentication. When you connect your NewsAPI account, Pipedream securely stores the keys so you can easily authenticate to NewsAPI APIs in both code and no-code steps.
Get your API key in your account settings.