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
```
The HTTP exit code can help you diagnose the success or failure of your REST call.
## Authentication
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:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
-d "import_sources[]=github" \
-d "import_sources[]=bitbucket" \
https://gitlab.example.com/api/v4/some_endpoint
"https://gitlab.example.com/api/v4/some_endpoint"
```
### `hash`
......@@ -605,7 +605,7 @@ curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--form "file=@/path/to/somefile.txt"
--form "override_params[visibility]=private" \
--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
......
......@@ -258,7 +258,7 @@ are paginated.
Read more on [pagination](README.md#pagination).
```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:
......@@ -318,7 +318,7 @@ GET /projects/:id/audit_events/:audit_event_id
| `audit_event_id` | integer | yes | The ID of the audit event |
```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:
......
......@@ -635,7 +635,7 @@ GET /projects/:id/repository/commits/:sha/statuses
| `all` | boolean | no | Return all statuses, not only the latest ones
```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:
......
......@@ -103,7 +103,7 @@ GET /projects/:id/feature_flags/:feature_flag_name
| `feature_flag_name` | string | yes | The name of the feature flag. |
```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:
......
......@@ -36,7 +36,7 @@ GET /projects/:id/feature_flags
| `scope` | string | no | The condition of feature flags, one of: `enabled`, `disabled`. |
```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:
......@@ -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. |
```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 "Content-type: application/json" \
--data @- << EOF
......@@ -244,7 +244,7 @@ GET /projects/:id/feature_flags/:name
| `name` | string | yes | The name of the feature flag. |
```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:
......@@ -320,5 +320,5 @@ DELETE /projects/:id/feature_flags/:name
| `name` | string | yes | The name of the feature flag. |
```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:
```shell
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" }' \
--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:
......
......@@ -29,7 +29,7 @@ Example:
```shell
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
......
......@@ -71,7 +71,7 @@ POST /import/bitbucket_server
```shell
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 "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" \
--data '{
......
......@@ -1652,13 +1652,13 @@ Supported attributes:
Example request:
```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:
```json
{
{
"id":699,
"type":null,
"body":"Lets promote this to an epic",
......
......@@ -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. |
```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
......
......@@ -246,7 +246,7 @@ GitLab API using `curl` and `jq` in a one-line command:
```shell
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 @-
```
......@@ -293,7 +293,7 @@ With a one-line command, you can:
```shell
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 @- \
| jq --raw-output '.merged_yaml | fromjson'
```
......@@ -376,7 +376,7 @@ Example request:
```shell
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" }] } }' \
--request POST https://gitlab.example.com/api/v4/projects/24/releases
--request POST "https://gitlab.example.com/api/v4/projects/24/releases"
```
Example response:
......
......@@ -39,7 +39,7 @@ Pagination follows the [SCIM spec](https://tools.ietf.org/html/rfc7644#section-3
Example request:
```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:
......
......@@ -20,7 +20,7 @@ GET /templates/dockerfiles
```
```shell
curl https://gitlab.example.com/api/v4/templates/dockerfiles
curl "https://gitlab.example.com/api/v4/templates/dockerfiles"
```
Example response:
......@@ -119,7 +119,7 @@ GET /templates/dockerfiles/:key
| `key` | string | yes | The key of the Dockerfile template |
```shell
curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary
curl "https://gitlab.example.com/api/v4/templates/dockerfiles/Binary"
```
Example response:
......
......@@ -21,7 +21,7 @@ GET /templates/gitignores
Example request:
```shell
curl https://gitlab.example.com/api/v4/templates/gitignores
curl "https://gitlab.example.com/api/v4/templates/gitignores"
```
Example response:
......@@ -126,7 +126,7 @@ GET /templates/gitignores/:key
Example request:
```shell
curl https://gitlab.example.com/api/v4/templates/gitignores/Ruby
curl "https://gitlab.example.com/api/v4/templates/gitignores/Ruby"
```
Example response:
......
......@@ -25,7 +25,7 @@ GET /templates/licenses
| `popular` | boolean | no | If passed, returns only popular licenses |
```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:
......@@ -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.
```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:
......
......@@ -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 |
```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.
......@@ -116,7 +116,7 @@ POST /security/vulnerability_exports
```
```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.
......
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