Skip to content

Commit 1f7cb3f

Browse files
committed
Add response header information
1 parent ee6740a commit 1f7cb3f

File tree

1 file changed

+54
-24
lines changed

1 file changed

+54
-24
lines changed

openapi.yaml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ info:
3939
<a target="_top" href="https://cloud.linode.com/profile/tokens">Linode Cloud Manager</a> or
4040
the [Create Personal Access Token](/docs/api/profile/#personal-access-token-create) endpoint.
4141

42-
All scopes for the OAuth security model ([defined below](/docs/api/profile/#oauth)) apply to this
42+
All scopes for the OAuth security model ([defined below](/docs/api/#oauth)) apply to this
4343
security model as well.
4444

45-
#### Authentication
45+
### Authentication
4646

4747
| Security Scheme Type: | HTTP |
4848
|-----------------------|------|
4949
| **HTTP Authorization Scheme** | bearer |
5050

51-
### OAuth
51+
## OAuth
52+
5253
If you only need to access the Linode API for personal use,
5354
we recommend that you create a [personal access token](/docs/api/#personal-access-token).
5455
If you're designing an application that can authenticate with an arbitrary Linode user, then
@@ -65,7 +66,7 @@ info:
6566
- A public client is used with applications where the client secret is not guaranteed to be secure. For example, a native app running on a user's computer may not be able to keep the client secret safe, as a user could potentially inspect the source of the application. So, native apps or apps that run in a user's browser should use a public client.
6667
- Public and private clients follow different workflows, as described below.
6768

68-
#### OAuth Workflow
69+
### OAuth Workflow
6970

7071
The OAuth workflow is a series of exchanges between your third-party app and Linode. The workflow is used
7172
to authenticate a user before an application can start making API calls on the user's behalf.
@@ -137,30 +138,34 @@ info:
137138

138139
You'll get another response with an updated `access_token` and `refresh_token`, which can then be used to refresh access again.
139140

140-
#### OAuth Reference
141+
### OAuth Reference
141142

142143
| Security Scheme Type | OAuth 2.0 |
143144
|-----------------------|--------|
144-
| **Authorization URL** | https://login.linode.com/oauth/authorize |
145-
| **Token URL** | https://login.linode.com/oauth/token |
145+
| **Authorization URL** | `https://login.linode.com/oauth/authorize` |
146+
| **Token URL** | `https://login.linode.com/oauth/token` |
146147
| **Scopes** | <ul><li>`account:read_only` - Allows access to GET information about your Account.</li><li>`account:read_write` - Allows access to all endpoints related to your Account.</li><li>`databases:read_only` - Allows access to GET Managed Databases on your Account.</li><li>`databases:read_write` - Allows access to all endpoints related to your Managed Databases.</li><li>`domains:read_only` - Allows access to GET Domains on your Account.</li><li>`domains:read_write` - Allows access to all Domain endpoints.</li><li>`events:read_only` - Allows access to GET your Events.</li><li>`events:read_write` - Allows access to all endpoints related to your Events.</li><li>`firewall:read_only` - Allows access to GET information about your Firewalls.</li><li>`firewall:read_write` - Allows access to all Firewall endpoints.</li><li>`images:read_only` - Allows access to GET your Images.</li><li>`images:read_write` - Allows access to all endpoints related to your Images.</li><li>`ips:read_only` - Allows access to GET your ips.</li><li>`ips:read_write` - Allows access to all endpoints related to your ips.</li><li>`linodes:read_only` - Allows access to GET Linodes on your Account.</li><li>`linodes:read_write` - Allow access to all endpoints related to your Linodes.</li><li>`lke:read_only` - Allows access to GET LKE Clusters on your Account.</li><li>`lke:read_write` - Allows access to all endpoints related to LKE Clusters on your Account.</li><li>`longview:read_only` - Allows access to GET your Longview Clients.</li><li>`longview:read_write` - Allows access to all endpoints related to your Longview Clients.</li><li>`nodebalancers:read_only` - Allows access to GET NodeBalancers on your Account.</li><li>`nodebalancers:read_write` - Allows access to all NodeBalancer endpoints.</li><li>`object_storage:read_only` - Allows access to GET information related to your Object Storage.</li><li>`object_storage:read_write` - Allows access to all Object Storage endpoints.</li><li>`stackscripts:read_only` - Allows access to GET your StackScripts.</li><li>`stackscripts:read_write` - Allows access to all endpoints related to your StackScripts.</li><li>`volumes:read_only` - Allows access to GET your Volumes.</li><li>`volumes:read_write` - Allows access to all endpoints related to your Volumes.</li></ul><br/>|
147148

148149
## Requests
149150

150-
Requests must be made over HTTPS to ensure transactions are encrypted. The
151-
following Request methods are supported:
151+
Requests must be made over HTTPS to ensure transactions are encrypted. Data included in requests must be supplied in json format unless otherwise specified in the command description.
152152

153-
| METHOD | USAGE |
154-
|--------|-------|
155-
| GET | Retrieves data about collections and individual resources. |
156-
| POST | For collections, creates a new resource of that type. Also used to perform actions on action endpoints. |
157-
| PUT | Updates an existing resource. |
158-
| DELETE | Deletes a resource. This is a destructive action. |
153+
The following request methods are supported:
159154

155+
| METHOD | USAGE |
156+
|---------|-------|
157+
| GET | Retrieves data about collections and individual resources. |
158+
| POST | For collections, creates a new resource of that type. Also used to perform actions on action endpoints. |
159+
| PUT | Updates an existing resource. |
160+
| DELETE | Deletes a resource. This is a destructive action. |
161+
| HEAD | Returns only the response header information of a GET request |
162+
| OPTIONS | Provides permitted communication options for a command |
160163

161164
## Responses
162165

163-
Actions will return one following HTTP response status codes:
166+
### Response Status Codes
167+
168+
Actions will return one of the following HTTP response status codes:
164169

165170
| STATUS | DESCRIPTION |
166171
|---------|-------------|
@@ -175,6 +180,38 @@ info:
175180
| 429 Too Many Requests | You've hit a rate limit. |
176181
| 500 Internal Server Error | Please [open a Support Ticket](/docs/api/support/#support-ticket-open). |
177182

183+
### Response Headers
184+
185+
There are many ways to access response header information for individual command URLs, depending on how you are accessing the Linode API. For example, to view HTTP response headers for the `/regions` endpoint when making requests with `curl`, use the `-I` or `--head` option as follows:
186+
187+
```Shell
188+
curl -I https://api.linode.com/v4/regions
189+
```
190+
191+
Responses may include the following headers:
192+
193+
| HEADER | DESCRIPTION | EXAMPLE |
194+
|--------|-------------|---------|
195+
| Access-Control-Allow-Credentials | Responses to credentialed requests are exposed to frontend JavaScript code. | true |
196+
| Access-Control-Allow-Headers | All permissible request headers for this endpoint. | Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter |
197+
| Access-Control-Allow-Methods | Permissible HTTP methods for this endpoint | HEAD, GET, OPTIONS, POST, PUT, DELETE |
198+
| Access-Control-Allow-Origin | Indicates origin access permissions. The wildcard character `*` means any origin can access the resource. | * |
199+
| Access-Control-Expose-Headers | Available headers to include in response to cross-origin requests. | X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status |
200+
| Cache-Control | Controls caching in browsers and shared caches such as CDNs. | private, max-age=60, s-maxage=60 |
201+
| Content-Security-Policy | Controls which resources are allowed to load. By default, resources do not load. | default-src 'none' |
202+
| Content-Type | All responses are in json format. | application/json |
203+
| Content-Warning | A message containing instructions for successful requests that were not able to be completed. | Please contact support for assistance. |
204+
| Retry-After | The remaining time in seconds until the current [rate limit](#rate-limiting) window resets. | 60 |
205+
| Strict-Transport-Security | Enforces HTTPS-only access until the returned time in seconds. | max-age=31536000 |
206+
| Vary | Optional request headers that affected the response content. | Authorization, X-Filter |
207+
| X-Accepted-OAuth-Scopes | Required [scopes](#oauth-reference) for accessing the requested command. | linodes:read_only |
208+
| X-Customer-UUID | A unique identifier for the account owning the the [personal access token](#personal-access-token) that was used for the request. | ABCDEF01-3456-789A-BCDEF0123456789A |
209+
| X-OAuth-Scopes | Allowed [scopes](#oauth-reference) associated with the [personal access token](#personal-access-token) that was used for the request. A value of `*` indicates read/write access for all scope categories. | images:read_write linodes:read_only |
210+
| X-RateLimit-Limit | The maximum number of permitted requests during the [rate limit](#rate-limiting) window for this endpoint. | 800 |
211+
| X-RateLimit-Remaining | The remaining number of permitted requests in the current [rate limit](#rate-limiting) window. | 798 |
212+
| X-RateLimit-Reset | The time when the current [rate limit](#rate-limiting) window rests in UTC epoch seconds. | 1674747739 |
213+
| X-Spec-Version | The current API version that handled the request. | 4.150.0 |
214+
178215
## Errors
179216

180217
Success is indicated via <a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes" target="_top">Standard HTTP status codes</a>.
@@ -193,7 +230,6 @@ info:
193230
new errors coming back once we are able to get further along in the process
194231
of handling your request.
195232

196-
197233
Within each error object, the `field` parameter will be included if the error
198234
pertains to a specific field in the JSON you've submitted. This will be
199235
omitted if there is no relevant field. The `reason` is a human-readable
@@ -363,19 +399,13 @@ info:
363399

364400
### Rate Limit HTTP Response Headers
365401

366-
The Linode API includes the following HTTP response headers which are designed to help you avoid hitting rate limits that might disrupt your applications:
402+
The Linode API includes the following HTTP response headers which are designed to help you avoid hitting rate limits which might disrupt your applications:
367403

368404
* **X-RateLimit-Limit**: The maximum number of permitted requests during the rate limit window for this endpoint.
369405
* **X-RateLimit-Remaining**: The remaining number of permitted requests in the current rate limit window.
370406
* **X-RateLimit-Reset**: The time when the current rate limit window rests in UTC epoch seconds.
371407
* **Retry-After**: The remaining time in seconds until the current rate limit window resets.
372408

373-
There are many ways to access header information for your requests, depending on how you are accessing the Linode API. For example, to view HTTP response headers when making requests with `curl`, use the `-i` or `--include` option as follows:
374-
375-
```Shell
376-
curl -i https://api.linode.com/v4/regions
377-
```
378-
379409
## CLI (Command Line Interface)
380410

381411
The <a href="https://github.com/linode/linode-cli" target="_top">Linode CLI</a> allows you to easily

0 commit comments

Comments
 (0)