Commit f102af7e authored by Steve Azzopardi's avatar Steve Azzopardi

Make job API docs consistent

In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23538 when
adding a new endpoint some docs incossintenies were pointed out.
parent 70de3ecd
...@@ -8,12 +8,12 @@ Get a list of jobs in a project. ...@@ -8,12 +8,12 @@ Get a list of jobs in a project.
GET /projects/:id/jobs GET /projects/:id/jobs
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-----------|---------|----------|---------------------| |-----------|--------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `scope` | string **or** array of strings | no | The scope of jobs to show, one or array of: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, `manual`; showing all jobs if none provided | | `scope` | string **or** array of strings | no | Scope of jobs to show. Either one of or an array of the following: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, or `manual`. All jobs are returned if `scope` is not provided. |
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" 'https://gitlab.example.com/api/v4/projects/1/jobs?scope[]=pending&scope[]=running' curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" 'https://gitlab.example.com/api/v4/projects/1/jobs?scope[]=pending&scope[]=running'
``` ```
...@@ -140,13 +140,13 @@ Get a list of jobs for a pipeline. ...@@ -140,13 +140,13 @@ Get a list of jobs for a pipeline.
GET /projects/:id/pipelines/:pipeline_id/jobs GET /projects/:id/pipelines/:pipeline_id/jobs
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|---------------|--------------------------------|----------|----------------------| |---------------|--------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `pipeline_id` | integer | yes | The ID of a pipeline | | `pipeline_id` | integer | yes | The ID of a pipeline. |
| `scope` | string **or** array of strings | no | The scope of jobs to show, one or array of: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, `manual`; showing all jobs if none provided | | `scope` | string **or** array of strings | no | Scope of jobs to show. Either one of or an array of the following: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, or `manual`. All jobs are returned if `scope` is not provided. |
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" 'https://gitlab.example.com/api/v4/projects/1/pipelines/6/jobs?scope[]=pending&scope[]=running' curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" 'https://gitlab.example.com/api/v4/projects/1/pipelines/6/jobs?scope[]=pending&scope[]=running'
``` ```
...@@ -273,12 +273,12 @@ Get a single job of a project ...@@ -273,12 +273,12 @@ Get a single job of a project
GET /projects/:id/jobs/:job_id GET /projects/:id/jobs/:job_id
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8" curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8"
``` ```
...@@ -350,33 +350,33 @@ Get job artifacts of a project. ...@@ -350,33 +350,33 @@ Get job artifacts of a project.
GET /projects/:id/jobs/:job_id/artifacts GET /projects/:id/jobs/:job_id/artifacts
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|------------|---------|----------|---------------------| |-------------|----------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
| `job_token` | string | no | To be used with [triggers] for multi-project pipelines. Is should be invoked only inside `.gitlab-ci.yml`. Its value is always `$CI_JOB_TOKEN`. | | `job_token` | string | no | To be used with [triggers] for multi-project pipelines. It should be invoked only inside `.gitlab-ci.yml`. Its value is always `$CI_JOB_TOKEN`. |
Example requests: Example requests:
- Using the `PRIVATE-TOKEN` header: - Using the `PRIVATE-TOKEN` header:
``` ```sh
curl --location --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts" curl --location --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts"
``` ```
- Using the `JOB-TOKEN` header (only inside `.gitlab-ci.yml`): - Using the `JOB-TOKEN` header (only inside `.gitlab-ci.yml`):
``` ```sh
curl --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts" curl --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts"
``` ```
- Using the `job_token` parameter (only inside `.gitlab-ci.yml`): - Using the `job_token` parameter (only inside `.gitlab-ci.yml`):
``` ```sh
curl --location --form "job-token=$CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts" curl --location --form "job-token=$CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/8/artifacts"
``` ```
Response: Possible response status codes:
| Status | Description | | Status | Description |
|-----------|---------------------------------| |-----------|---------------------------------|
...@@ -402,34 +402,34 @@ GET /projects/:id/jobs/artifacts/:ref_name/download?job=name ...@@ -402,34 +402,34 @@ GET /projects/:id/jobs/artifacts/:ref_name/download?job=name
Parameters Parameters
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-------------|---------|----------|-------------------------- | |-------------|----------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `ref_name` | string | yes | The ref from a repository (can only be branch or tag name, not HEAD or SHA) | | `ref_name` | string | yes | Branch or tag name in repository. HEAD or SHA references are not supported. |
| `job` | string | yes | The name of the job | | `job` | string | yes | The name of the job. |
| `job_token` | string | no | To be used with [triggers] for multi-project pipelines. Is should be invoked only inside `.gitlab-ci.yml`. Its value is always `$CI_JOB_TOKEN`. | | `job_token` | string | no | To be used with [triggers] for multi-project pipelines. It should be invoked only inside `.gitlab-ci.yml`. Its value is always `$CI_JOB_TOKEN`. |
Example requests: Example requests:
- Using the `PRIVATE-TOKEN` header: - Using the `PRIVATE-TOKEN` header:
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test" curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"
``` ```
- Using the `JOB-TOKEN` header (only inside `.gitlab-ci.yml`): - Using the `JOB-TOKEN` header (only inside `.gitlab-ci.yml`):
``` ```sh
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test" curl --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"
``` ```
- Using the `job_token` parameter (only inside `.gitlab-ci.yml`): - Using the `job_token` parameter (only inside `.gitlab-ci.yml`):
``` ```sh
curl --header --form "job-token=$CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test" curl --header --form "job-token=$CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test"
``` ```
Example response: Possible response status codes:
| Status | Description | | Status | Description |
|-----------|---------------------------------| |-----------|---------------------------------|
...@@ -442,9 +442,9 @@ Example response: ...@@ -442,9 +442,9 @@ Example response:
> Introduced in GitLab 10.0 > Introduced in GitLab 10.0
Download a single artifact file from within the job's artifacts archive. Download a single artifact file from a job with a specified ID from within
the job's artifacts archive. The file is extracted from the archive and
Only a single file is going to be extracted from the archive and streamed to a client. streamed to the client.
``` ```
GET /projects/:id/jobs/:job_id/artifacts/*artifact_path GET /projects/:id/jobs/:job_id/artifacts/*artifact_path
...@@ -452,19 +452,19 @@ GET /projects/:id/jobs/:job_id/artifacts/*artifact_path ...@@ -452,19 +452,19 @@ GET /projects/:id/jobs/:job_id/artifacts/*artifact_path
Parameters Parameters
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-----------------|---------|----------|-------------------------- | |-----------------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id ` | integer | yes | The unique job identifier | | `job_id ` | integer | yes | The unique job identifier. |
| `artifact_path` | string | yes | Path to a file inside the artifacts archive | | `artifact_path` | string | yes | Path to a file inside the artifacts archive. |
Example request: Example request:
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/5/artifacts/some/release/file.pdf" curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/5/artifacts/some/release/file.pdf"
``` ```
Example response: Possible response status codes:
| Status | Description | | Status | Description |
|-----------|--------------------------------------| |-----------|--------------------------------------|
...@@ -515,16 +515,16 @@ Get a trace of a specific job of a project ...@@ -515,16 +515,16 @@ Get a trace of a specific job of a project
GET /projects/:id/jobs/:job_id/trace GET /projects/:id/jobs/:job_id/trace
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| id | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | id | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| job_id | integer | yes | The ID of a job | | job_id | integer | yes | The ID of a job. |
``` ```sh
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8/trace" curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/8/trace"
``` ```
Response: Possible response status codes:
| Status | Description | | Status | Description |
|-----------|-----------------------------------| |-----------|-----------------------------------|
...@@ -539,12 +539,12 @@ Cancel a single job of a project ...@@ -539,12 +539,12 @@ Cancel a single job of a project
POST /projects/:id/jobs/:job_id/cancel POST /projects/:id/jobs/:job_id/cancel
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
``` ```sh
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/cancel" curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/cancel"
``` ```
...@@ -587,12 +587,12 @@ Retry a single job of a project ...@@ -587,12 +587,12 @@ Retry a single job of a project
POST /projects/:id/jobs/:job_id/retry POST /projects/:id/jobs/:job_id/retry
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
``` ```sh
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/retry" curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/retry"
``` ```
...@@ -637,14 +637,14 @@ POST /projects/:id/jobs/:job_id/erase ...@@ -637,14 +637,14 @@ POST /projects/:id/jobs/:job_id/erase
Parameters Parameters
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
Example of request Example of request
``` ```sh
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/erase" curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/erase"
``` ```
...@@ -690,14 +690,14 @@ POST /projects/:id/jobs/:job_id/artifacts/keep ...@@ -690,14 +690,14 @@ POST /projects/:id/jobs/:job_id/artifacts/keep
Parameters Parameters
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-------------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
Example request: Example request:
``` ```sh
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/artifacts/keep" curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/artifacts/keep"
``` ```
...@@ -741,12 +741,12 @@ Triggers a manual action to start a job. ...@@ -741,12 +741,12 @@ Triggers a manual action to start a job.
POST /projects/:id/jobs/:job_id/play POST /projects/:id/jobs/:job_id/play
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
|-----------|---------|----------|---------------------| |-----------|----------------|----------|------------------------------------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. |
| `job_id` | integer | yes | The ID of a job | | `job_id` | integer | yes | The ID of a job. |
``` ```sh
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/play" curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v4/projects/1/jobs/1/play"
``` ```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment