DominicFinn / GetJsonFromUrl

A simple file to get JSON from a URL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Simple class to get JSON from a URL the endpoint requires basic authorization.

Usage example:

    const ApiService = require('./ApiService');

    const apiKey = Buffer.from('username:password').toString('base64');

    const apiService = new ApiService(apiKey);

    const results = await apiService.getJsonFromUrl('', (json) => {
        // return json.results (or whatever transform you need to do)

        return json;

    // results will return null and write to log if there's an issue 
    if(results) {

ezoic increase your site revenue


A simple file to get JSON from a URL


Language:JavaScript 100.0%