Sends a HTTP request to the Backstage API. It uses the token of the user who triggers the task to authenticate requests.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| body | any | - | |
| path | string | - | |
| method | string | - | |
| params | object | - | |
| headers | object | - | |
| timeout | number | - | |
| logRequestPath | boolean | - | |
| continueOnBadResponse | boolean | - |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| body | any | - | |
| code | string | - | |
| headers | object | - |
Usage Examples
Check if a Catalog entity exists by name
Use this to verify that an expected entity is already present in the Catalog before proceeding. This typically runs after fetching your template with fetch:template.
steps:
- id: fetchBase
action: fetch:template
input:
url: https://github.com/acme/software-templates/archive/main.zip
targetPath: ./skeleton
values:
name: ${{ parameters.serviceName }}
- id: lookupEntity
action: http:backstage:request
input:
path: /api/catalog/entities/by-name
method: GET
params:
kind: Component
namespace: default
name: ${{ parameters.serviceName }}
headers:
Accept: application/json
logRequestPath: true
timeout: 5000Trigger a Catalog refresh for a new component
After publishing a new repository with publish:github, request a Catalog refresh so the entity is quickly re-ingested.
steps:
- id: publishRepo
action: publish:github
input:
repoUrl: github.com?owner=acme&repo=${{ parameters.repoName }}
defaultBranch: main
protectDefaultBranch: true
description: ${{ parameters.description }}
- id: refreshCatalog
action: http:backstage:request
input:
path: /api/catalog/refresh
method: POST
headers:
Content-Type: application/json
Accept: application/json
body:
entityRef: component:default/${{ parameters.serviceName }}
timeout: 3000Register a Catalog location for the new repository
Register the catalog-info.yaml of the newly created repo so it appears in the Catalog. This is useful right after publish:github.
steps:
- id: publishRepo
action: publish:github
input:
repoUrl: github.com?owner=acme&repo=${{ parameters.repoName }}
defaultBranch: main
protectDefaultBranch: true
description: ${{ parameters.description }}
- id: registerLocation
action: http:backstage:request
input:
path: /api/catalog/locations
method: POST
headers:
Content-Type: application/json
Accept: application/json
body:
type: url
target: https://github.com/acme/${{ parameters.repoName }}/blob/main/catalog-info.yaml
presence: optional
continueOnBadResponse: true
logRequestPath: true
timeout: 10000Remove a deprecated Catalog location
Use this to clean up a Catalog location when decommissioning or migrating services. The step tolerates missing locations.
steps:
- id: cleanupLocation
action: http:backstage:request
input:
path: /api/catalog/locations/${{ parameters.locationId }}
method: DELETE
continueOnBadResponse: true
timeout: 5000Probe TechDocs availability with a HEAD request
Check whether TechDocs content is available for a component without downloading the document. This can run after template setup with fetch:template.
steps:
- id: fetchBase
action: fetch:template
input:
url: https://github.com/acme/software-templates/archive/main.zip
targetPath: ./skeleton
values:
name: ${{ parameters.serviceName }}
- id: checkTechDocs
action: http:backstage:request
input:
path: /api/techdocs/static/docs/default/component/${{ parameters.serviceName }}/index.html
method: HEAD
continueOnBadResponse: true
logRequestPath: true
timeout: 2000