fix api request

This commit is contained in:
Simon Larsen 2023-04-06 08:54:19 +01:00
parent f68b179a8e
commit 8b6e0df420
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
7 changed files with 78 additions and 25 deletions

View File

@ -1,3 +1,10 @@
Request Headers:
Authorization: Bearer {secret-api-key}
TenantId: {project-id}
Request Body:
{ {
"query": { "query": {
// query object (optional, if left optional it'll select everything) // query object (optional, if left optional it'll select everything)

View File

@ -1,3 +1,10 @@
Request Headers:
Authorization: Bearer {secret-api-key}
TenantId: {project-id}
Request Body:
{ {
"data": { "data": {
// properties to update as JSON. // properties to update as JSON.

View File

@ -1,3 +1,4 @@
{ Request Headers:
} Authorization: Bearer {secret-api-key}
TenantId: {project-id}

View File

@ -1,3 +1,10 @@
Request Headers:
Authorization: Bearer {secret-api-key}
TenantId: {project-id}
Request Body:
{ {
"select": { "select": {
// select object (optional, if left optional it'll only fetch ID). // select object (optional, if left optional it'll only fetch ID).

View File

@ -1,3 +1,10 @@
Request Headers:
Authorization: Bearer {secret-api-key}
TenantId: {project-id}
Request Body:
{ {
"select": { "select": {
// select object (optional, if left optional it'll only fetch ID). // select object (optional, if left optional it'll only fetch ID).

View File

@ -1,3 +1,10 @@
Request Headers:
Authorization: Bearer {secret-api-key}
TenantId: {project-id}
Request Body:
{ {
"data": { "data": {
// properties to update as JSON. // properties to update as JSON.

View File

@ -1,23 +1,40 @@
<main class="py-16"> <main class="py-16">
<article class="prose dark:prose-invert"> <article class="prose dark:prose-invert">
<h1>Authentication</h1> <h1>Authentication</h1>
<p class="lead">You'll need to authenticate your requests to access any of the endpoints in the OneUptime API. In this guide, we'll look at how authentication works. OneUptime offers one way to authenticate your API requests - by using an API Key.</p> <p class="lead">You'll need to authenticate your requests to access any of the endpoints in the OneUptime API. In
<h2 id="basic-authentication" class="mb-5 scroll-mt-24 mt-24 font-bold text-lg"> this guide, we'll look at how authentication works. OneUptime offers one way to authenticate your API requests
Generate an API Key - by using an API Key.</p>
</h2>
<p> Please head over to <b>Project Settings</b> > <b>API Keys</b>. Create a new API Key. Please note: New API Keys have no permissions assigned to them, so you will have to assign a permission before you can use it.</p>
<a class="mt-5 inline-flex gap-0.5 justify-center overflow-hidden font-medium transition text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500" href="/reference/permissions"> <h2 id="basic-authentication" class="mb-5 scroll-mt-24 mt-24 font-bold text-lg">
Read more about permissions Generate an API Key
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" class="mt-0.5 h-5 w-5 relative top-px -mr-1"> </h2>
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"></path> <p> Please head over to <b>Project Settings</b> > <b>API Keys</b>. Create a new API Key. Please note: New API Keys
</svg> have no permissions assigned to them, so you will have to assign a permission before you can use it.</p>
</a> <a class="mt-5 inline-flex gap-0.5 justify-center overflow-hidden font-medium transition text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500"
href="/reference/permissions">
<h2 id="basic-authentication"> Read more about permissions
Authentication with API Key <svg viewBox="0 0 20 20" fill="none" aria-hidden="true" class="mt-0.5 h-5 w-5 relative top-px -mr-1">
</h2> <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
<p>You can use OneUptime API Key on Request Header when you're making a requst. You can use <code class="rounded p-0.5 px-1 text-sm text-gray-500 bg-gray-100 border-2 border-gray-200">Authorization</code> header with your API Key when you make a request.</p> d="m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"></path>
<%- include('../partials/code', {title: "Example request with API Key", requestUrl: "", requestType: "", code: "curl --header \"Authorization: Bearer {secret-api-key}\" https://oneuptime.com/api/\<path\>" }) -%> </svg>
<p class="text-sm">Please don't commit your OneUptime API Key to GitHub, or on any other source control project. Please regenerate a new API Key, if your API Key is comitted by mistake.</p> </a>
</article>
</main> <h2 id="basic-authentication" class="mb-5 scroll-mt-24 mt-24 font-bold text-lg">
Project ID
</h2>
<p> Please head over to <b>Project Settings</b> > <b>Project</b>. You should see your Project ID there.</p>
<h2 id="basic-authentication">
Authentication with API Key and Project ID
</h2>
<p>You can use OneUptime API Key on Request Header when you're making a requst. You can use <code
class="rounded p-0.5 px-1 text-sm text-gray-500 bg-gray-100 border-2 border-gray-200">Authorization</code>
header with your API Key when you make a request.</p>
<%- include('../partials/code', {title: "Example request with API Key" , requestUrl: "" , requestType: "" ,
code: "curl --header \" Authorization: Bearer {secret-api-key}\" --header \"TenantId: {project-id}\"
https://oneuptime.com/api/\<path\>" }) -%>
<p class="text-sm">Please don't commit your OneUptime API Key to GitHub, or on any other source control
project. Please regenerate a new API Key, if your API Key is comitted by mistake.</p>
</article>
</main>