Skip to content

Commit 0933c52

Browse files
committed
Merge branch 'v2-more' into v2
2 parents a749ded + 83bdbff commit 0933c52

File tree

6 files changed

+302
-11
lines changed

6 files changed

+302
-11
lines changed
File renamed without changes.

docs/api/introduction.mdx

Lines changed: 287 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
---
2+
title: Plane API Documentation
3+
sidebar_label: Introduction
4+
description: Use the Plane API to programatically read and write changes to your Workspaces, Projects, Work Items and much more.
5+
sidebar_position: 0
6+
---
7+
8+
{frontMatter.description && <h3 className="description">{frontMatter.description}</h3>}
9+
10+
:::info
11+
The Plane cloud API is available at `https://api.plane.so/`
12+
:::
13+
14+
## Quick start
15+
16+
### 1. Get your API key
17+
18+
To make requests to the Plane API, you'll need an API key. This key is used to
19+
verify your client's identity and permissions. The key must be passed as the
20+
value of the `X-API-Key` header.
21+
22+
Enough talk. Let's get you an API key!
23+
24+
:::tip
25+
You must have a Plane account or be registered to your instance to generate a key.
26+
:::
27+
28+
1. Log into your Plane account and go to **Profile Settings**
29+
![Profile Settings](/images/api-reference/profile-settings.png#center)
30+
2. Go to **Personal Access Tokens**
31+
![API Tokens](/images/api-reference/api-tokens-plane.png#center)
32+
3. Click **Add personal access token**
33+
![Add API key](/images/api-reference/add-api-key-plane.png#center)
34+
4. Enter a title and description to help you remember why you created this key
35+
5. Optionally set an expiry date for the key, after which time the key will no longer be valid
36+
37+
:::danger
38+
Treat your API key like a password. Keep it secret. Keep it safe. It is
39+
important to store your API key securely and keep it confidential to prevent
40+
unauthorized access to your account. Do not share it or expose it in
41+
client-side code.
42+
:::
43+
44+
### 2. Execute an HTTP request 🔄
45+
46+
When issuing HTTP requests to the API, you'll always set the `x-api-key`
47+
request header to your API key. For example, if using `curl` this looks like:
48+
49+
```bash
50+
curl -L 'https://api.plane.so/api/v1/workspaces/:slug/projects/:project_id/issues/' \
51+
-H 'Accept: application/json' \
52+
-H 'X-API-Key: <X-API-Key>'
53+
```
54+
55+
Run the above command to receive your first response from the Plane API.
56+
57+
### 3. Congratulations 🥳
58+
59+
Congratulations! You've successfully run your first HTTP request using the
60+
[Plane](https://plane.so) API. Next, browse the rest of our documentation for
61+
more examples of how you can integrate your project! 😎
62+
63+
___
64+
65+
## General API usage
66+
67+
### Base URL
68+
69+
All requests to the Plane Cloud API must be made to the following base URL:
70+
71+
```
72+
https://api.plane.so/
73+
```
74+
75+
:::info
76+
If you're using a self-hosted instance of Plane, your API base URL will differ based on your custom domain and setup.
77+
:::
78+
79+
### Security recommendations
80+
81+
- **Keep the API Key Secret**: Treat your API key like a password. Do not share it or expose it in client-side code.
82+
- **Regenerate Key If Compromised**: If you suspect that your API key has been compromised, generate a new one immediately and update your applications.
83+
84+
### API key errors
85+
86+
- If the **`X-API-Key`** header is not included, the API will return an error indicating that authentication is required.
87+
- If the provided API key is invalid or expired, the API will return an error message indicating an authentication failure.
88+
89+
### HTTP methods
90+
91+
HTTP defines a set of request methods, also known as HTTP verbs, to indicate the desired action for a given resource.
92+
93+
Given below is the list of methods commonly adopted by Plane's API:
94+
95+
|Verb |Description |Example |
96+
|------|---------------------------------------------------|-----------------------------------|
97+
|GET |Requests a representation of the specified resource|Fetch all work items from a project|
98+
|POST |Submits an entity to the specified resource |Create a project |
99+
|DELETE|Deletes the specified resource |Delete a work item |
100+
|PATCH |Applies partial modifications to a resource |Edit a module |
101+
102+
### Status codes
103+
104+
Given below is the list of the most commonly encountered success responses:
105+
106+
| Status Code | Description |
107+
|----------------|----------------------------------------------------------------------------------------|
108+
| 200 OK | The request succeeded. Generally used in GET or PATCH requests. |
109+
| 201 Created | The request succeeded and a new resource was created. Generally used in POST requests. |
110+
| 204 No Content | The request succeeded and no body is returned. Generally used in DELETE requests. |
111+
112+
### Error responses
113+
114+
Given below is the list of the most commonly encountered error responses:
115+
116+
| Status Code | Description |
117+
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
118+
| 400 Bad Request | The server cannot or will not process the request due to something that is perceived to be a client error. |
119+
| 401 Unauthorized | Although the HTTP standard specifies "unauthorized", semantically, this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. |
120+
| 404 Not Found | The server cannot find the requested resource. This means the URL is not recognized. |
121+
| 429 Throttling Error | The server has received too many requests from your client within a short period of time. Retry the request later. You can read more in our [rate-limiting](#rate-limiting) section. |
122+
| 500 Internal Server Error | The server has encountered a situation it does not know how to handle, and failed to process the request. |
123+
| 502 Bad Gateway | The server received an invalid response from another service which was required to handle the request. |
124+
| 503 Service Unavailable | The server is not ready to handle the request. Common causes are a server that is down for maintenance or overloaded. |
125+
| 504 Gateway Timeout | The server was unable to receive a timely response from a downstream service.
126+
127+
128+
---
129+
130+
## Pagination
131+
132+
The Plane API implements a cursor-based pagination system, allowing clients to
133+
efficiently navigate through large datasets. The system uses a cursor parameter
134+
to manage the position and direction of pagination.
135+
136+
### Querystring parameters
137+
138+
Paging is controlled by clients via the following querystring parameters.
139+
140+
- **`per_page` (optional)**: Number of items to display per page. Defaults to 100. The maximum allowed value is 100.
141+
- **`cursor` (optional)**: Cursor string (see below) to navigate to a specific page. If not provided, pagination starts from the first page.
142+
143+
### Cursor string format
144+
145+
The cursor string is formatted as **`value:offset:is_prev`**, where:
146+
147+
- **`value`** represents the page size (number of items per page)
148+
- **`offset`** is the current page number (starting from 0)
149+
- **`is_prev`** indicates whether the cursor is moving to the previous page (**`1`**) or to the next page (**`0`**)
150+
151+
### Example: Fetching the first page
152+
153+
```
154+
GET /api/v1/workspaces/:workspace-slug/projects/:project_id/issues/?per_page=20
155+
```
156+
157+
#### Pagination response
158+
159+
The paginated response includes the following fields:
160+
161+
- **`next_cursor`**: Cursor string for the next page
162+
- **`prev_cursor`**: Cursor string for the previous page
163+
- **`next_page_results`**: Boolean indicating if there are more results after the current page
164+
- **`prev_page_results`**: Boolean indicating if there are results before the current page
165+
- **`count`**: Total number of items on the current page
166+
- **`total_pages`**: Estimated total number of pages
167+
- **`total_results`**: Total number of items across all pages
168+
- **`extra_stats`**: Additional statistics, if any
169+
- **`results`**: Array of items for the current page
170+
171+
Here's an example response for the first page of results:
172+
173+
```json
174+
{
175+
"next_cursor": "20:1:0",
176+
"prev_cursor": "",
177+
"next_page_results": true,
178+
"prev_page_results": false,
179+
"count": 20,
180+
"total_pages": 50,
181+
"total_results": 1000,
182+
"extra_stats": {},
183+
"results": [ ... items ... ]
184+
}
185+
```
186+
187+
### Example: Fetching the next page
188+
189+
```
190+
GET /api/v1/workspaces/:workspace-slug/projects/:project_id/issues?per_page=20&cursor=20:1:0
191+
```
192+
193+
#### Pagination next page response
194+
195+
```json
196+
{
197+
"next_cursor": "20:2:0",
198+
"prev_cursor": "20:0:1",
199+
"next_page_results": true,
200+
"prev_page_results": true,
201+
"count": 20,
202+
"total_pages": 50,
203+
"total_results": 1000,
204+
"extra_stats": {},
205+
"results": [ ... items ... ]
206+
}
207+
```
208+
209+
### Pagination errors
210+
211+
- **Invalid Cursor Format**: If the provided cursor string is not in the correct format, the API will respond with an error message indicating an invalid cursor format.
212+
- **Pagination Limits**: Requests exceeding the maximum **`per_page`** limit will receive an error response detailing the maximum allowed value.
213+
214+
---
215+
216+
## Rate limiting
217+
218+
To ensure fair usage and maintain the overall quality of service for the
219+
community, the Plane API implements rate limiting. Rate limiting restricts the
220+
number of requests a client can make within a certain time frame.
221+
222+
### Rate limit details
223+
224+
- **Limit**: Each client is limited to 60 requests per minute
225+
- **Reset Interval**: The rate limit counter resets every minute
226+
- **Scope of Limitation**: The rate limit applies to all requests made with a given API key
227+
228+
### Identifying your rate limit status
229+
230+
Your current rate limit status is communicated in the response headers of each API request:
231+
232+
- **`X-RateLimit-Remaining`**: The number of requests remaining in the current rate limit window
233+
- **`X-RateLimit-Reset`**: The time at which the current rate limit window resets (in UTC epoch seconds)
234+
235+
```
236+
X-RateLimit-Remaining: 45
237+
X-RateLimit-Reset: 1700327957
238+
```
239+
240+
---
241+
242+
## Fine tuning response fields
243+
244+
The Plane API provides flexible data retrieval capabilities through two powerful query
245+
parameters: `fields` and `expand`. These parameters allow clients to tailor the
246+
response data to their specific needs, optimizing both the payload size and the
247+
clarity of the response.
248+
249+
### Fields parameter
250+
251+
The `fields` parameter enables clients to selectively retrieve only a subset of
252+
fields for a given resource.
253+
254+
:::tip
255+
The `fields` parameter is particularly useful for reducing response time, size
256+
and bandwidth, especially when your client requires only specific pieces of data.
257+
:::
258+
259+
The **`fields`** parameter accepts a comma-separated list of field names that
260+
the client wants to be included in the response. For example, to include only
261+
the `id`, `name`, and `description` fields, send the following querystring parameters:
262+
263+
```
264+
GET /api/v1/workspaces/:workspace-slug/projects/:project_id/issues/?fields=id,name,description
265+
```
266+
267+
#### Fields parameter error handling
268+
269+
Invalid or unrecognized field names passed in the **`fields`** parameter will
270+
result in an error response, indicating which fields are invalid.
271+
272+
### Expand parameter
273+
274+
The `expand` parameter allows clients to request additional related information to
275+
be included in the response. This is useful for retrieving detailed information
276+
about nested resources without making separate API calls.
277+
278+
For example, to return the resource data along with expanded information about
279+
the `assignees` and `state`, send the following querystring parameters:
280+
281+
```
282+
GET /api/v1/workspaces/:workspace-slug/projects/:project_id/issues/?expand=assignees,state
283+
```
284+
285+
#### Expand parameter error handling
286+
287+
If **`expand`** is used on fields that cannot be expanded, an appropriate error message will be returned.

docs/api/the-plane-rest-api.info.mdx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
id: the-plane-rest-api
33
title: "The Plane REST API"
44
description: "The Plane REST API"
5-
sidebar_label: Introduction
6-
sidebar_position: 0
75
hide_title: true
86
custom_edit_url: null
97
---
@@ -49,10 +47,10 @@ Visit our quick start guide and full API documentation at [developers.plane.so](
4947
label={"API Key: ApiKeyAuthentication"}
5048
value={"ApiKeyAuthentication"}
5149
>
52-
53-
50+
51+
5452
API key authentication. Provide your API key in the X-API-Key header.
55-
53+
5654
<div>
5755
<table>
5856
<tbody>
@@ -76,10 +74,10 @@ Visit our quick start guide and full API documentation at [developers.plane.so](
7674
label={"OAuth 2.0: OAuth2Authentication"}
7775
value={"OAuth2Authentication"}
7876
>
79-
80-
77+
78+
8179
OAuth2 authentication supporting both authorization code flow and client credentials flow. For client credentials flow, include 'app_installation_id' parameter in the token request payload to receive a bot token for workspace app installations.
82-
80+
8381
<div>
8482
<table>
8583
<tbody>
@@ -154,4 +152,3 @@ Visit our quick start guide and full API documentation at [developers.plane.so](
154152
GNU AGPLv3
155153
</a>
156154
</div>
157-

docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { CardGroup } from '@site/src/components/CardGroup';
2828
<Card title="Self-Hosting" icon="FaDocker" href="/self-hosting/overview">
2929
Learn how to self-host Plane.
3030
</Card>
31-
<Card title="API Reference" icon="FaCog" href="/api/the-plane-rest-api">
31+
<Card title="API Reference" icon="FaCog" href="/api/introduction">
3232
Use our API reference to build a custom integration.
3333
</Card>
3434
<Card title="Webhooks" icon="FaCog" href="/webhooks/overview">

docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ const config: Config = {
339339
docsPluginId: 'classic', // configured for preset-classic
340340
config: {
341341
plane: {
342-
specPath: 'api-spec/schema.yaml',
342+
specPath: 'api/schema.yaml',
343343
outputDir: 'docs/api',
344344
sidebarOptions: {
345345
groupPathsBy: 'tag',

sidebars.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
33

44
import apiSidebar from './docs/api/sidebar.js';
55

6+
// Substitute our custom intro page b/c it's nicer than the generated one.
7+
const indexPage = apiSidebar[0]
8+
if (!(indexPage.type === 'doc' && indexPage.id === 'api/the-plane-rest-api')) {
9+
throw new Error('Could not find API index page. Aborting.');
10+
}
11+
apiSidebar[0].id = 'api/introduction';
12+
613
const sidebars: SidebarsConfig = {
714
sidebar: [
815
{

0 commit comments

Comments
 (0)