Skip to content

Commit

Permalink
Fix indentation and page descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
stefannica committed Feb 7, 2025
1 parent 2813725 commit f76a6d7
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 47 deletions.
12 changes: 6 additions & 6 deletions docs/book/getting-started/zenml-pro/pro-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ To generate a new API token for the ZenML Pro API:

* using curl:

```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://cloudapi.zenml.io/users/me
```
```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://cloudapi.zenml.io/users/me
```

* using wget:

```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://cloudapi.zenml.io/users/me
```
```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://cloudapi.zenml.io/users/me
```

{% hint style="info" %}
**Important Notes**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
description: >-
Connect to the ZenML server using the ZenML CLI and the web based login.
---

# Connect in with your User (interactive)

You can authenticate your clients with the ZenML Server using the ZenML CLI and the web based login. This can be executed with the command:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
description: >-
Connect to the ZenML server using a service account and an API key.
---

# Connect with a Service Account

Sometimes you may need to authenticate to a ZenML server from a non-interactive environment where the web login is not possible, like a CI/CD workload or a serverless function. In these cases, you can configure a service account and an API key and use the API key to authenticate to the ZenML server:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
description: >-
Connect to the ZenML server using a temporary API token.
---

# Connect with an API Token

API tokens provide a way to authenticate with the ZenML server for temporary automation tasks. These tokens are scoped to your user account and are valid for a maximum of 1 hour.
Expand Down
82 changes: 41 additions & 41 deletions docs/book/reference/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ You can generate a short-lived (1 hour) API token from your ZenML dashboard. Thi

* using curl:

```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```
```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```

* using wget:

```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```
```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```

{% hint style="info" %}
**Important Notes**
Expand All @@ -55,42 +55,42 @@ You can use a service account's API key to obtain short-lived API tokens for pro

1. Create a [service account](../how-to/manage-zenml-server/connecting-to-zenml/connect-with-a-service-account.md):

```shell
zenml service-account create myserviceaccount
```
```shell
zenml service-account create myserviceaccount
```

This will print out the `<ZENML_API_KEY>`, you can use in the next steps.

2. To obtain an API token using your API key, send a POST request to the `/api/v1/login` endpoint. Here are examples using common HTTP clients:

* using curl:

```bash
curl -X POST -d "password=<YOUR_API_KEY>" https://your-zenml-server/api/v1/login
```
```bash
curl -X POST -d "password=<YOUR_API_KEY>" https://your-zenml-server/api/v1/login
```

* using wget:

```bash
wget -qO- --post-data="password=<YOUR_API_KEY>" \
--header="Content-Type: application/x-www-form-urlencoded" \
https://your-zenml-server/api/v1/login
```
```bash
wget -qO- --post-data="password=<YOUR_API_KEY>" \
--header="Content-Type: application/x-www-form-urlencoded" \
https://your-zenml-server/api/v1/login
```

* using python:

```python
import requests
import json
```python
import requests
import json
response = requests.post(
"https://your-zenml-server/api/v1/login",
data={"password": "<YOUR_API_KEY>"},
headers={"Content-Type": "application/x-www-form-urlencoded"}
)
response = requests.post(
"https://your-zenml-server/api/v1/login",
data={"password": "<YOUR_API_KEY>"},
headers={"Content-Type": "application/x-www-form-urlencoded"}
)
print(response.json())
```
print(response.json())
```

This will return a response like this:

Expand All @@ -108,28 +108,28 @@ This will return a response like this:

* using curl:

```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```
```bash
curl -H "Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```

* using wget:

```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```
```bash
wget -qO- --header="Authorization: Bearer YOUR_API_TOKEN" https://your-zenml-server/api/v1/current-user
```

* using python:

```python
import requests
```python
import requests
response = requests.get(
"https://your-zenml-server/api/v1/current-user",
headers={"Authorization": f"Bearer {YOUR_API_TOKEN}"}
)
response = requests.get(
"https://your-zenml-server/api/v1/current-user",
headers={"Authorization": f"Bearer {YOUR_API_TOKEN}"}
)
print(response.json())
```
print(response.json())
```

{% hint style="info" %}
**Important notes**
Expand Down

0 comments on commit f76a6d7

Please sign in to comment.