...
The HTTP/S Connector allows to connect to such external systems using the HTTP/S protocol. TODOFor example if you would like to make RESTful calls.
Typically such endpoints are secured with username and password or a token. You should never place such sensitive data into your source code. Instead, create a new Secrets and refer to it in your pipeline.
Here is an example to access the GitHub API using the command http.get
and a custom secret, created before:
Code Block | ||
---|---|---|
| ||
pipeline:
- http.get:
url: "https://api.github.com/owner/repo/actions/artifacts"
secret: "github-secret" |
This will return a JSON document like this example, which can be used in the pipeline for further processing:
Code Block | ||
---|---|---|
| ||
{
"total_count": 1,
"artifacts": [
{
"id": 11,
"node_id": "MDg6QXJ0bbZhY3QxMQ==",
"name": "Rails",
"size_in_bytes": 556,
"url": "https://api.github.com/repos/owner/repo/actions/artifacts/11",
"archive_download_url": "https://api.github.com/repos/owner/repo/actions/artifacts/11/zip",
"expired": false,
"created_at": "2022-01-10T14:59:22Z",
"expires_at": "2022-03-21T14:59:22Z",
"updated_at": "2022-02-21T14:59:22Z",
"workflow_run": {
"id": 2332928,
"repository_id": 1296569,
"head_repository_id": 1296219,
"head_branch": "main",
"head_sha": "328faa0536e6fef19903d9d91dc96a9931694ce3"
}
}
]
}
|
Also see these connector commands: