Skip to content

Commit 53cdb36

Browse files
committed
On-demand reporting docs
1 parent cfcd6b5 commit 53cdb36

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

docs/guides/images/api_keys.png

69.2 KB
Loading

docs/guides/ondemand-reports.md

+44-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,52 @@ This feature is in beta
1616

1717
:::
1818

19-
CodeRabbit offers a way to generate on-demand reports using the [API](https://api.coderabbit.ai/api/swagger/).
20-
You will be able to use the API by creating an [API key](https://app.coderabbit.ai/settings/api-keys).
19+
CodeRabbit offers a way to generate on-demand reports using the [CodeRabbit API](https://api.coderabbit.ai/api/swagger/).
20+
You will need an API Key to access the CodeRabbit API and generate an on-demand report.
2121

22+
## Create an API key
2223

23-
On-demand report input schema:
24+
Sign into your CodeRabbit account and navigate to the the [**API Keys**](https://app.coderabbit.ai/settings/api-keys) page under 'Organization Settings' in the left sidebar.
25+
Click on the **Create API Key** button and enter a name for the API Key.
26+
Copy the API key and keep it safe as it won't be visible again.
27+
28+
![API Keys](./images/api_keys.png)
29+
30+
## Generate an On-demand report
31+
32+
Once you have the API key, pass it in the `x-coderabbitai-api-key` header when calling the API:
33+
34+
```sh
35+
curl -X 'POST' \
36+
'https://api.coderabbit.ai/api/v1/report.generate' \
37+
-H 'accept: application/json' \
38+
-H 'x-coderabbitai-api-key: cr-xxxxxxxxxxxxx' \
39+
-H 'Content-Type: application/json' \
40+
-d '{
41+
"from": "2024-05-01",
42+
"to": "2024-05-15"
43+
}'
44+
```
45+
46+
Sample output:
47+
48+
```sh
49+
[
50+
{
51+
"group": "Developer Activity",
52+
"report": "*Developer Activity*:\n\n 🟢 **Update README.md** [#10](https://gitlab.com/master-group123/sub-group/project1/-/merge_requests/10)\n• Summary: The change updates the project description and modifies a section header for clearer instructions.\n• Last activity: 1 day ago, mergeable\n• Insights:\n - :magnifying_glass: @user2 Suggested updating the wording to make it clearer"
53+
}
54+
]
55+
```
56+
57+
58+
:::info
59+
60+
If you get a 401 UNAUTHORIZED error, check if you're passing the right API key in the `x-coderabbitai-api-key` header
61+
62+
:::
63+
64+
The on-demand report generation endpoints take in inputs as per the schema shown below:
2465

2566
```mdx-code-block
2667
<ReportSchema />

0 commit comments

Comments
 (0)