[Draft] Secure Files API Documentation
stage: Verify
group: Pipeline Authoring
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference, api
Project-level Secure Files API (FREE)
List project secure files
Get list of a project's secure fles.
GET /projects/:project_id/secure_files
Attribute | Type | Required | Description |
---|---|---|---|
project_id |
integer/string | yes | The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/secure_files"
[
{
"id": 1,
"name": "myfile.jks",
"checksum": "16630b189ab34b2e3504f4758e1054d2e478deda510b2b08cc0ef38d12e80aac",
"checksum_algorithm": "sha256",
"permissions": "read_only",
"created_at": "2022-02-22T22:22:22.222Z"
},
{
"id": 2,
"name": "myotherfile.jks",
"checksum": "16630b189ab34b2e3504f4758e1054d2e478deda510b2b08cc0ef38d12e80aa2",
"checksum_algorithm": "sha256",
"permissions": "execute",
"created_at": "2022-02-22T22:22:22.222Z"
}
]
Show secure file details
Get the details of a project's specific secure file.
GET /projects/:project_id/secure_files/:id
Attribute | Type | Required | Description |
---|---|---|---|
project_id |
integer/string | yes | The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user |
id |
integer | yes | The id of a secure file |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/secure_files/1"
{
"id": 1,
"name": "myfile.jks",
"checksum": "16630b189ab34b2e3504f4758e1054d2e478deda510b2b08cc0ef38d12e80aac",
"checksum_algorithm": "sha256",
"permissions": "read_only",
"created_at": "2022-02-22T22:22:22.222Z"
}
Create secure file
Create a new secure file.
POST /projects/:project_id/secure_files
Attribute | Type | Required | Description |
---|---|---|---|
project_id |
integer/string | yes | The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user |
name |
string | yes | The name of the file being uploaded |
file |
file | yes | The file being uploaded |
permissions |
string | no | The permissions the file should be set to when created in a CI job. Available types are: read_only (default), read_write , and execute
|
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/1/secure_files" --form "name=myfile.jks" --form "file=@/path/to/file/myfile.jks"
{
"id": 1,
"name": "myfile.jks",
"checksum": "16630b189ab34b2e3504f4758e1054d2e478deda510b2b08cc0ef38d12e80aac",
"checksum_algorithm": "sha256",
"permissions": "read_only",
"created_at": "2022-02-22T22:22:22.222Z"
}
Download secure file
Download the contents of a project's secure file.
GET /projects/:project_id/download/:id
Attribute | Type | Required | Description |
---|---|---|---|
project_id |
integer/string | yes | The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user |
id |
integer | yes | The id of a secure file |
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/secure_files/1/download --output myfile.jks
Remove secure file
Remove a project's secure file.
DELETE /projects/:project_id/secure_files/:id
Attribute | Type | Required | Description |
---|---|---|---|
project_id |
integer/string | yes | The ID of a project or URL-encoded NAMESPACE/PROJECT_NAME of the project owned by the authenticated user |
id |
integer | yes | The id of a secure file |
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/secure_files/1"
Edited by Darby Frey