From 8b6e0df4209188141b764a40eebdd66c23976049 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 6 Apr 2023 08:54:19 +0100 Subject: [PATCH] fix api request --- .../CodeExamples/Model/CountRequest.md | 7 +++ .../CodeExamples/Model/CreateRequest.md | 7 +++ .../CodeExamples/Model/DeleteRequest.md | 7 ++- .../CodeExamples/Model/ItemRequest.md | 7 +++ .../CodeExamples/Model/ListRequest.md | 7 +++ .../CodeExamples/Model/UpdateRequest.md | 7 +++ ApiReference/views/main/authentication.ejs | 61 ++++++++++++------- 7 files changed, 78 insertions(+), 25 deletions(-) diff --git a/ApiReference/CodeExamples/Model/CountRequest.md b/ApiReference/CodeExamples/Model/CountRequest.md index 1a05c3608f..a4e349fdd6 100644 --- a/ApiReference/CodeExamples/Model/CountRequest.md +++ b/ApiReference/CodeExamples/Model/CountRequest.md @@ -1,3 +1,10 @@ +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} + +Request Body: + { "query": { // query object (optional, if left optional it'll select everything) diff --git a/ApiReference/CodeExamples/Model/CreateRequest.md b/ApiReference/CodeExamples/Model/CreateRequest.md index 64f5b4d3ee..721b92feab 100644 --- a/ApiReference/CodeExamples/Model/CreateRequest.md +++ b/ApiReference/CodeExamples/Model/CreateRequest.md @@ -1,3 +1,10 @@ +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} + +Request Body: + { "data": { // properties to update as JSON. diff --git a/ApiReference/CodeExamples/Model/DeleteRequest.md b/ApiReference/CodeExamples/Model/DeleteRequest.md index 4367a83fc8..eeec23feca 100644 --- a/ApiReference/CodeExamples/Model/DeleteRequest.md +++ b/ApiReference/CodeExamples/Model/DeleteRequest.md @@ -1,3 +1,4 @@ -{ - -} \ No newline at end of file +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} diff --git a/ApiReference/CodeExamples/Model/ItemRequest.md b/ApiReference/CodeExamples/Model/ItemRequest.md index b7f0d8e2a8..835519cf9b 100644 --- a/ApiReference/CodeExamples/Model/ItemRequest.md +++ b/ApiReference/CodeExamples/Model/ItemRequest.md @@ -1,3 +1,10 @@ +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} + +Request Body: + { "select": { // select object (optional, if left optional it'll only fetch ID). diff --git a/ApiReference/CodeExamples/Model/ListRequest.md b/ApiReference/CodeExamples/Model/ListRequest.md index c07758b784..2aba499296 100644 --- a/ApiReference/CodeExamples/Model/ListRequest.md +++ b/ApiReference/CodeExamples/Model/ListRequest.md @@ -1,3 +1,10 @@ +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} + +Request Body: + { "select": { // select object (optional, if left optional it'll only fetch ID). diff --git a/ApiReference/CodeExamples/Model/UpdateRequest.md b/ApiReference/CodeExamples/Model/UpdateRequest.md index 64f5b4d3ee..721b92feab 100644 --- a/ApiReference/CodeExamples/Model/UpdateRequest.md +++ b/ApiReference/CodeExamples/Model/UpdateRequest.md @@ -1,3 +1,10 @@ +Request Headers: + +Authorization: Bearer {secret-api-key} +TenantId: {project-id} + +Request Body: + { "data": { // properties to update as JSON. diff --git a/ApiReference/views/main/authentication.ejs b/ApiReference/views/main/authentication.ejs index 86e59cc914..ce99e2ca7e 100644 --- a/ApiReference/views/main/authentication.ejs +++ b/ApiReference/views/main/authentication.ejs @@ -1,23 +1,40 @@
-
-

Authentication

-

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.

-

- Generate an API Key -

-

Please head over to Project Settings > API Keys. 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.

- - Read more about permissions - - - -

- Authentication with API Key -

-

You can use OneUptime API Key on Request Header when you're making a requst. You can use Authorization header with your API Key when you make a request.

- <%- include('../partials/code', {title: "Example request with API Key", requestUrl: "", requestType: "", code: "curl --header \"Authorization: Bearer {secret-api-key}\" https://oneuptime.com/api/\" }) -%> -

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.

-
-
\ No newline at end of file +
+

Authentication

+

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.

+ + +

+ Generate an API Key +

+

Please head over to Project Settings > API Keys. 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.

+ + Read more about permissions + + + +

+ Project ID +

+

Please head over to Project Settings > Project. You should see your Project ID there.

+ +

+ Authentication with API Key and Project ID +

+

You can use OneUptime API Key on Request Header when you're making a requst. You can use Authorization + header with your API Key when you make a request.

+ <%- 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/\" }) -%> +

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.

+
+ \ No newline at end of file