Skip to content

Extend JSON Plugin with headers config option #137

@d-koppenhagen

Description

@d-koppenhagen

🧩 Feature request

Description

The JSON Plugin is great to fetch data from an API. However sometimes API are not public and to access those Data an API key or other HTTP headers are needed to be sent when requesting the API.

Describe the solution you'd like

The scully config should accept a headers object for the JSON Plugin where a user can specify one or more headers when requesting the endpoint:

// scully.config.js
exports.config = {
  routes: {
    "/user/:userId": {
      "type": "json",
      "userId": {
        "url": "https://my-api.com/users",
        "property": "id",
        "headers": {
           "X-API-Key": "27482824848327373",
        }
      }
    }
  }
};

Describe alternatives you've considered

Have you considered any alternative solutions or workarounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions