update: change status page api
This commit is contained in:
parent
7877b14f85
commit
c70ceaba67
|
|
@ -113,7 +113,7 @@ async function replaceGroupsAndMonitors(
|
|||
}
|
||||
}
|
||||
|
||||
export const statusPages = new Elysia({ prefix: "/status-pages" })
|
||||
export const statusPages = new Elysia({ prefix: "/pages" })
|
||||
.use(requireAuth)
|
||||
|
||||
.get("/", async ({ accountId }) => {
|
||||
|
|
|
|||
|
|
@ -724,7 +724,7 @@ export const dashboard = new Elysia()
|
|||
try {
|
||||
const apiUrl = process.env.API_URL || "https://api.pingql.com";
|
||||
const key = cookie?.pingql_key?.value;
|
||||
await fetch(`${apiUrl}/status-pages/`, {
|
||||
await fetch(`${apiUrl}/pages/`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${key}` },
|
||||
body: JSON.stringify({
|
||||
|
|
@ -781,7 +781,7 @@ export const dashboard = new Elysia()
|
|||
// alone. Empty string falls through to this branch on purpose.
|
||||
if (b.remove_password) payload.password = null;
|
||||
else if (b.password) payload.password = b.password;
|
||||
await fetch(`${apiUrl}/status-pages/${params.id}`, {
|
||||
await fetch(`${apiUrl}/pages/${params.id}`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${key}` },
|
||||
body: JSON.stringify(payload),
|
||||
|
|
@ -796,7 +796,7 @@ export const dashboard = new Elysia()
|
|||
try {
|
||||
const apiUrl = process.env.API_URL || "https://api.pingql.com";
|
||||
const key = cookie?.pingql_key?.value;
|
||||
await fetch(`${apiUrl}/status-pages/${params.id}`, {
|
||||
await fetch(`${apiUrl}/pages/${params.id}`, {
|
||||
method: "DELETE",
|
||||
headers: { "Authorization": `Bearer ${key}` },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -264,11 +264,11 @@ Content-Type: application/json
|
|||
<p>Create public status pages that display live uptime, heartbeat bars, and incidents for your monitors. Each page gets a unique slug and is publicly accessible at <code>status.pingql.com/{slug}</code>.</p>
|
||||
|
||||
<h3>List pages</h3>
|
||||
<div class="endpoint"><span class="method get">GET</span><span class="path">/status-pages</span></div>
|
||||
<div class="endpoint"><span class="method get">GET</span><span class="path">/pages</span></div>
|
||||
<p class="endpoint-desc">Returns all status pages for the authenticated account.</p>
|
||||
|
||||
<h3>Create page</h3>
|
||||
<div class="endpoint"><span class="method post">POST</span><span class="path">/status-pages</span></div>
|
||||
<div class="endpoint"><span class="method post">POST</span><span class="path">/pages</span></div>
|
||||
<div class="cb">
|
||||
<div class="cb-header"><span class="cb-lang">json - request body</span></div>
|
||||
<pre>{
|
||||
|
|
@ -324,15 +324,15 @@ Content-Type: application/json
|
|||
</table>
|
||||
|
||||
<h3>Get page</h3>
|
||||
<div class="endpoint"><span class="method get">GET</span><span class="path">/status-pages/:id</span></div>
|
||||
<div class="endpoint"><span class="method get">GET</span><span class="path">/pages/:id</span></div>
|
||||
<p class="endpoint-desc">Returns the page with its <code>groups</code> and <code>monitors</code> arrays, plus <code>has_password</code> (boolean).</p>
|
||||
|
||||
<h3>Update page</h3>
|
||||
<div class="endpoint"><span class="method patch">PATCH</span><span class="path">/status-pages/:id</span></div>
|
||||
<div class="endpoint"><span class="method patch">PATCH</span><span class="path">/pages/:id</span></div>
|
||||
<p class="endpoint-desc">All fields optional. If <code>groups</code> or <code>monitors</code> are provided, they replace the full set.</p>
|
||||
|
||||
<h3>Delete page</h3>
|
||||
<div class="endpoint"><span class="method delete">DELETE</span><span class="path">/status-pages/:id</span></div>
|
||||
<div class="endpoint"><span class="method delete">DELETE</span><span class="path">/pages/:id</span></div>
|
||||
<p class="endpoint-desc">Permanently removes the page and all associated groups and monitor links.</p>
|
||||
|
||||
<h3>Public endpoints</h3>
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@
|
|||
<span class="ml-3 text-xs text-gray-500 font-mono">Create a status page</span>
|
||||
</div>
|
||||
<div class="terminal-body text-xs sm:text-[13px]">
|
||||
<pre><span class="text-gray-500">$</span> <span class="text-white">curl</span> -X POST https://pingql.com/api/status-pages \
|
||||
<pre><span class="text-gray-500">$</span> <span class="text-white">curl</span> -X POST https://pingql.com/api/pages \
|
||||
-H <span class="syn-str">"X-Key: abcd-1234-efgh-5678"</span> \
|
||||
-d <span class="syn-str">'{
|
||||
"slug": "my-app",
|
||||
|
|
|
|||
Loading…
Reference in New Issue