Skip to content
Source plugin for Netlify's API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.eslintrc
.gitignore
.npmignore
LICENSE
README.md
index.js
package.json
yarn.lock

README.md

gatsby-source-netlify

Source plugin for Netlify's API.

Please Note: This plugin was initially created to deliver data for my dashboard and hence only queries the user and sites. If you need more functionality, I'd be happy to review your PR and merge it into this plugin!

Install

npm install --save gatsby-source-netlify

How to use

Prerequisites

Go to OAuth applications and create a new access token ("Personal access tokens").

Save the API key in an environment file like:

NETLIFY_KEY=your-access-token-here

gatsby-config

Add the plugin and define the API key.

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-netlify',
      options: {
        apiKey: process.env.NETLIFY_KEY,
      }
    }
  ]
}

Options

As per netlify/js-client you can also define options when passing the access token, for example:

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-netlify',
      options: {
        apiKey: process.env.NETLIFY_KEY,
        opts: {
          userAgent: 'netlify/js-client',
          scheme: 'https',
          host: 'api.netlify.com',
          pathPrefix: '/api/v1',
          globalParams: {} // parameters you want available for every request.
          // Global params are only sent of the open-api spec specifies the provided params.
        }
      }
    }
  ]
}
You can’t perform that action at this time.