Scaffolder: HTTP Requests logo

Backstage HTTP request scaffolder actions

Create HTTP requests with the scaffolder

Created by Roadie

Skip the manual plugin installation with no-code Backstage

Request a Roadie demo

Installation steps

Install the plugin into your scaffolded Backstage application.

cd packages/backend
yarn add @roadiehq/scaffolder-backend-module-http-request

Add http request actions to your scaffolder backend

// packages/backend/src/plugins/scaffolder.ts

const actions = [
  createHttpBackstageAction({ config }),
  ...createBuiltinActions({
    containerRunner,
    integrations,
    config,
    catalogClient,
    reader,
  }),
];

return await createRouter({
  containerRunner,
  logger,
  config,
  database,
  catalogClient,
  reader,
  actions,
});

Create template with http actions

...
  steps:
    - id: backstage_request
      name: backstage request
      action: http:backstage:request
      input:
        method: 'GET'
        path: '/proxy/snyk/org/<some-org>/project/<some-project-id>/aggregated-issues'
        headers:
          test: 'hello'
          foo: 'bar'
        params:
          name: 'test'
          bar: 'foo'

    - id: backstage_request_with_input
      name: backstage request
      action: http:backstage:request
      input:
        method: 'POST'
        path: '/proxy/snyk/org/<some-org>/project/<some-project-id>/aggregated-issues/get/some/job{{ steps["backstage_request"].output.body.number }}'
        headers:
            test: 'hello'
            foo: 'bar'
        body:
            name: 'test'
            bar: 'foo'

  output:
    getResponse: '{{ steps["backstage_request_with_input"].output.body }}'
    getCode: '{{ steps["backstage_request_with_input"].output.code }}'
    getHeaders: '{{ steps["backstage_request_with_input"].output.headers }}'
...

Found a mistake? Update these instructions.

Things to know

This scaffolder action is meant to be used in a scaffolded Backstage application created by Backstage CLI. If you are using it in a Backstage monorepo, you need to modify the build process to transpile node_modules also.

NB: The path should always point to a proxy entry with the following format: proxy/<proxy-path>/<external-api-path>. i.e.: /proxy/snyk/org/<some-org>/projects or /proxy/circleci/api/projects (the CircleCI proxy path is circleci/api/ but Snyk is just snyk/)

Prefer a no-code Backstage setup?

Request a Roadie demo

Become a Backstage expert

To get the latest news, deep dives into Backstage features, and a roundup of recent open-source action, sign up for Roadie's Backstage Weekly. See recent editions.

We will never sell or share your email address.