Commit 5ac3da77 authored by Marcel Amirault's avatar Marcel Amirault

Merge branch '276200-docs-api-curl-double-quote' into 'master'

Docs: double quote cURL URLs in /docs/api/

See merge request gitlab-org/gitlab!49447
parents 81905ed4 b463a4eb
...@@ -107,7 +107,7 @@ curl: (22) The requested URL returned error: 404 ...@@ -107,7 +107,7 @@ curl: (22) The requested URL returned error: 404
``` ```
The HTTP exit code can help you diagnose the success or failure of your REST call. The HTTP exit code can help you diagnose the success or failure of your REST call.
## Authentication ## Authentication
Most API requests require authentication, or only return public data when Most API requests require authentication, or only return public data when
...@@ -591,7 +591,7 @@ We can call the API with `array` and `hash` types parameters as follows: ...@@ -591,7 +591,7 @@ We can call the API with `array` and `hash` types parameters as follows:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
-d "import_sources[]=github" \ -d "import_sources[]=github" \
-d "import_sources[]=bitbucket" \ -d "import_sources[]=bitbucket" \
https://gitlab.example.com/api/v4/some_endpoint "https://gitlab.example.com/api/v4/some_endpoint"
``` ```
### `hash` ### `hash`
...@@ -605,7 +605,7 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \ ...@@ -605,7 +605,7 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--form "file=@/path/to/somefile.txt" --form "file=@/path/to/somefile.txt"
--form "override_params[visibility]=private" \ --form "override_params[visibility]=private" \
--form "override_params[some_other_param]=some_value" \ --form "override_params[some_other_param]=some_value" \
https://gitlab.example.com/api/v4/projects/import "https://gitlab.example.com/api/v4/projects/import"
``` ```
### Array of hashes ### Array of hashes
......
...@@ -258,7 +258,7 @@ are paginated. ...@@ -258,7 +258,7 @@ are paginated.
Read more on [pagination](README.md#pagination). Read more on [pagination](README.md#pagination).
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/projects/7/audit_events curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/projects/7/audit_events"
``` ```
Example response: Example response:
...@@ -318,7 +318,7 @@ GET /projects/:id/audit_events/:audit_event_id ...@@ -318,7 +318,7 @@ GET /projects/:id/audit_events/:audit_event_id
| `audit_event_id` | integer | yes | The ID of the audit event | | `audit_event_id` | integer | yes | The ID of the audit event |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/projects/7/audit_events/5 curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/projects/7/audit_events/5"
``` ```
Example response: Example response:
......
...@@ -635,7 +635,7 @@ GET /projects/:id/repository/commits/:sha/statuses ...@@ -635,7 +635,7 @@ GET /projects/:id/repository/commits/:sha/statuses
| `all` | boolean | no | Return all statuses, not only the latest ones | `all` | boolean | no | Return all statuses, not only the latest ones
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/statuses curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/statuses"
``` ```
Example response: Example response:
......
...@@ -103,7 +103,7 @@ GET /projects/:id/feature_flags/:feature_flag_name ...@@ -103,7 +103,7 @@ GET /projects/:id/feature_flags/:feature_flag_name
| `feature_flag_name` | string | yes | The name of the feature flag. | | `feature_flag_name` | string | yes | The name of the feature flag. |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"
``` ```
Example response: Example response:
......
...@@ -36,7 +36,7 @@ GET /projects/:id/feature_flags ...@@ -36,7 +36,7 @@ GET /projects/:id/feature_flags
| `scope` | string | no | The condition of feature flags, one of: `enabled`, `disabled`. | | `scope` | string | no | The condition of feature flags, one of: `enabled`, `disabled`. |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/feature_flags curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/feature_flags"
``` ```
Example response: Example response:
...@@ -174,7 +174,7 @@ POST /projects/:id/feature_flags ...@@ -174,7 +174,7 @@ POST /projects/:id/feature_flags
| `scopes:strategies` | JSON | no | The [strategies](../operations/feature_flags.md#feature-flag-strategies) of the feature flag spec. | | `scopes:strategies` | JSON | no | The [strategies](../operations/feature_flags.md#feature-flag-strategies) of the feature flag spec. |
```shell ```shell
curl https://gitlab.example.com/api/v4/projects/1/feature_flags \ curl "https://gitlab.example.com/api/v4/projects/1/feature_flags" \
--header "PRIVATE-TOKEN: <your_access_token>" \ --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-type: application/json" \ --header "Content-type: application/json" \
--data @- << EOF --data @- << EOF
...@@ -244,7 +244,7 @@ GET /projects/:id/feature_flags/:name ...@@ -244,7 +244,7 @@ GET /projects/:id/feature_flags/:name
| `name` | string | yes | The name of the feature flag. | | `name` | string | yes | The name of the feature flag. |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace"
``` ```
Example response: Example response:
...@@ -320,5 +320,5 @@ DELETE /projects/:id/feature_flags/:name ...@@ -320,5 +320,5 @@ DELETE /projects/:id/feature_flags/:name
| `name` | string | yes | The name of the feature flag. | | `name` | string | yes | The name of the feature flag. |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" --request DELETE https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature curl --header "PRIVATE-TOKEN: <your_access_token>" --request DELETE "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"
``` ```
...@@ -101,7 +101,7 @@ Example request: ...@@ -101,7 +101,7 @@ Example request:
```shell ```shell
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: <your_access_token>" \ curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: <your_access_token>" \
--data '{ "freeze_start": "0 23 * * 5", "freeze_end": "0 7 * * 1", "cron_timezone": "UTC" }' \ --data '{ "freeze_start": "0 23 * * 5", "freeze_end": "0 7 * * 1", "cron_timezone": "UTC" }' \
--request POST https://gitlab.example.com/api/v4/projects/19/freeze_periods --request POST "https://gitlab.example.com/api/v4/projects/19/freeze_periods"
``` ```
Example response: Example response:
......
...@@ -29,7 +29,7 @@ Example: ...@@ -29,7 +29,7 @@ Example:
```shell ```shell
GRAPHQL_TOKEN=<your-token> GRAPHQL_TOKEN=<your-token>
curl 'https://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}" curl "https://gitlab.com/api/graphql" --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}"
``` ```
### GraphiQL ### GraphiQL
......
...@@ -71,7 +71,7 @@ POST /import/bitbucket_server ...@@ -71,7 +71,7 @@ POST /import/bitbucket_server
```shell ```shell
curl --request POST \ curl --request POST \
--url https://gitlab.example.com/api/v4/import/bitbucket_server \ --url "https://gitlab.example.com/api/v4/import/bitbucket_server" \
--header "content-type: application/json" \ --header "content-type: application/json" \
--header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" \ --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" \
--data '{ --data '{
......
...@@ -1652,13 +1652,13 @@ Supported attributes: ...@@ -1652,13 +1652,13 @@ Supported attributes:
Example request: Example request:
```shell ```shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=Lets%20promote%20this%20to%20an%20epic%0A%0A%2Fpromote curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=Lets%20promote%20this%20to%20an%20epic%0A%0A%2Fpromote"
``` ```
Example response: Example response:
```json ```json
{ {
"id":699, "id":699,
"type":null, "type":null,
"body":"Lets promote this to an epic", "body":"Lets promote this to an epic",
......
...@@ -293,7 +293,7 @@ GET /projects/:id/pipelines/:pipeline_id/bridges ...@@ -293,7 +293,7 @@ GET /projects/:id/pipelines/:pipeline_id/bridges
| `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. | | `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. |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" 'https://gitlab.example.com/api/v4/projects/1/pipelines/6/bridges?scope[]=pending&scope[]=running' curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/6/bridges?scope[]=pending&scope[]=running"
``` ```
Example of response Example of response
......
...@@ -246,7 +246,7 @@ GitLab API using `curl` and `jq` in a one-line command: ...@@ -246,7 +246,7 @@ GitLab API using `curl` and `jq` in a one-line command:
```shell ```shell
jq --null-input --arg yaml "$(<example-gitlab-ci.yml)" '.content=$yaml' \ jq --null-input --arg yaml "$(<example-gitlab-ci.yml)" '.content=$yaml' \
| curl 'https://gitlab.com/api/v4/ci/lint?include_merged_yaml=true' \ | curl "https://gitlab.com/api/v4/ci/lint?include_merged_yaml=true" \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data @- --data @-
``` ```
...@@ -293,7 +293,7 @@ With a one-line command, you can: ...@@ -293,7 +293,7 @@ With a one-line command, you can:
```shell ```shell
jq --null-input --arg yaml "$(<example-gitlab-ci.yml)" '.content=$yaml' \ jq --null-input --arg yaml "$(<example-gitlab-ci.yml)" '.content=$yaml' \
| curl 'https://gitlab.com/api/v4/ci/lint?include_merged_yaml=true' \ | curl "https://gitlab.com/api/v4/ci/lint?include_merged_yaml=true" \
--header 'Content-Type: application/json' --data @- \ --header 'Content-Type: application/json' --data @- \
| jq --raw-output '.merged_yaml | fromjson' | jq --raw-output '.merged_yaml | fromjson'
``` ```
...@@ -376,7 +376,7 @@ Example request: ...@@ -376,7 +376,7 @@ Example request:
```shell ```shell
curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" \ curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" \
--data '{ "name": "New release", "tag_name": "v0.3", "description": "Super nice release", "milestones": ["v1.0", "v1.0-rc"], "assets": { "links": [{ "name": "hoge", "url": "https://google.com", "filepath": "/binaries/linux-amd64", "link_type":"other" }] } }' \ --data '{ "name": "New release", "tag_name": "v0.3", "description": "Super nice release", "milestones": ["v1.0", "v1.0-rc"], "assets": { "links": [{ "name": "hoge", "url": "https://google.com", "filepath": "/binaries/linux-amd64", "link_type":"other" }] } }' \
--request POST https://gitlab.example.com/api/v4/projects/24/releases --request POST "https://gitlab.example.com/api/v4/projects/24/releases"
``` ```
Example response: Example response:
......
...@@ -39,7 +39,7 @@ Pagination follows the [SCIM spec](https://tools.ietf.org/html/rfc7644#section-3 ...@@ -39,7 +39,7 @@ Pagination follows the [SCIM spec](https://tools.ietf.org/html/rfc7644#section-3
Example request: Example request:
```shell ```shell
curl 'https://gitlab.example.com/api/scim/v2/groups/test_group/Users?filter=id%20eq%20"0b1d561c-21ff-4092-beab-8154b17f82f2"' --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json" curl "https://gitlab.example.com/api/scim/v2/groups/test_group/Users?filter=id%20eq%20%220b1d561c-21ff-4092-beab-8154b17f82f2%22" --header "Authorization: Bearer <your_scim_token>" --header "Content-Type: application/scim+json"
``` ```
Example response: Example response:
......
...@@ -20,7 +20,7 @@ GET /templates/dockerfiles ...@@ -20,7 +20,7 @@ GET /templates/dockerfiles
``` ```
```shell ```shell
curl https://gitlab.example.com/api/v4/templates/dockerfiles curl "https://gitlab.example.com/api/v4/templates/dockerfiles"
``` ```
Example response: Example response:
...@@ -119,7 +119,7 @@ GET /templates/dockerfiles/:key ...@@ -119,7 +119,7 @@ GET /templates/dockerfiles/:key
| `key` | string | yes | The key of the Dockerfile template | | `key` | string | yes | The key of the Dockerfile template |
```shell ```shell
curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"
``` ```
Example response: Example response:
......
...@@ -21,7 +21,7 @@ GET /templates/gitignores ...@@ -21,7 +21,7 @@ GET /templates/gitignores
Example request: Example request:
```shell ```shell
curl https://gitlab.example.com/api/v4/templates/gitignores curl "https://gitlab.example.com/api/v4/templates/gitignores"
``` ```
Example response: Example response:
...@@ -126,7 +126,7 @@ GET /templates/gitignores/:key ...@@ -126,7 +126,7 @@ GET /templates/gitignores/:key
Example request: Example request:
```shell ```shell
curl https://gitlab.example.com/api/v4/templates/gitignores/Ruby curl "https://gitlab.example.com/api/v4/templates/gitignores/Ruby"
``` ```
Example response: Example response:
......
...@@ -25,7 +25,7 @@ GET /templates/licenses ...@@ -25,7 +25,7 @@ GET /templates/licenses
| `popular` | boolean | no | If passed, returns only popular licenses | | `popular` | boolean | no | If passed, returns only popular licenses |
```shell ```shell
curl https://gitlab.example.com/api/v4/templates/licenses?popular=1 curl "https://gitlab.example.com/api/v4/templates/licenses?popular=1"
``` ```
Example response: Example response:
...@@ -128,7 +128,7 @@ If you omit the `fullname` parameter but authenticate your request, the name of ...@@ -128,7 +128,7 @@ If you omit the `fullname` parameter but authenticate your request, the name of
the authenticated user replaces the copyright holder placeholder. the authenticated user replaces the copyright holder placeholder.
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/templates/licenses/mit?project=My+Cool+Project curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/templates/licenses/mit?project=My+Cool+Project"
``` ```
Example response: Example response:
......
...@@ -83,7 +83,7 @@ POST /security/groups/:id/vulnerability_exports ...@@ -83,7 +83,7 @@ POST /security/groups/:id/vulnerability_exports
| `id` | integer or string | yes | The ID or [URL-encoded path](README.md#namespaced-path-encoding) of the group which the authenticated user is a member of | | `id` | integer or string | yes | The ID or [URL-encoded path](README.md#namespaced-path-encoding) of the group which the authenticated user is a member of |
```shell ```shell
curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/security/groups/1/vulnerability_exports curl --header POST "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/security/groups/1/vulnerability_exports"
``` ```
The created vulnerability export is automatically deleted after 1 hour. The created vulnerability export is automatically deleted after 1 hour.
...@@ -116,7 +116,7 @@ POST /security/vulnerability_exports ...@@ -116,7 +116,7 @@ POST /security/vulnerability_exports
``` ```
```shell ```shell
curl --header POST "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/security/vulnerability_exports curl --header POST "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/security/vulnerability_exports"
``` ```
The created vulnerability export is automatically deleted after one hour. The created vulnerability export is automatically deleted after one hour.
......
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