Skip to content

danielfcollier/js-gas-library-fetch-json

Repository files navigation

[Library for Google Apps Script] Fetch JSON

Using the Library

There are two ways to import the library to your project:

  • Set in your script project dashboard
  • Add the configuration into your appsscript.json
  1. Script Id:
1VwgEzQRhb6igER9A5Jd_yXHaTBUG1tEBXxt6_W5UudkyUAeFT9T0vY_N
  1. Add the latest version: for example, 4
  2. Use the identifier FetchJson

These actions will update your appsscript.json.

Or, you can update it directly adding to the dependencies object:

"dependencies": {
    "libraries": [
      {
        "userSymbol": "FetchJson",
        "version": "4",
        "libraryId": "1VwgEzQRhb6igER9A5Jd_yXHaTBUG1tEBXxt6_W5UudkyUAeFT9T0vY_N"
      }
    ]
}

The script runs in the timezone Etc/GMT.

FetchJson

Options

Required: headers Optional: verbose, where the default value is false

Example:

const options = {
  headers: {},
  verbose: true,
};

Methods

Get

const response = FetchJson.Get(url, options);

Post

The payload is a JSON object.

const response = FetchJson.Post(url, payload, options);

Put

const response = FetchJson.Put(url, payload, options);

Delete (Remove)

const response = FetchJson.Remove(url, options);

Logging

Use the option parameter verboseset to true to enable logging.

Tests

This library has been tested along with the library Asaas Payment API.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published