Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
P Portal-api
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • doc
  • Portal-api
  • Wiki
  • Home

Home · Changes

Page history
Added simple example, still have to test the example authored Apr 15, 2022 by Jurjen Brouwer's avatar Jurjen Brouwer
Hide whitespace changes
Inline Side-by-side
Showing with 41 additions and 2 deletions
+41 -2
  • home.md home.md +41 -2
  • No files found.
home.md
View page @ f1c2557b
...@@ -74,8 +74,47 @@ The API can return a few different status codes depending on if the call was suc ...@@ -74,8 +74,47 @@ The API can return a few different status codes depending on if the call was suc
| 401 Unauthorized | Current Bearer token is no longer valid. | | 401 Unauthorized | Current Bearer token is no longer valid. |
| 403 Forbidden | You are not allowed to perform this action. Most likely due to not having enough rights to perform this action. | | 403 Forbidden | You are not allowed to perform this action. Most likely due to not having enough rights to perform this action. |
| 404 Not Found | The URL to the API is not correct, or cannot be found. | | 404 Not Found | The URL to the API is not correct, or cannot be found. |
| 429 Too Many Requests | The maximum amount of allowable calls has been reached for this API request. The current API rate limiter uses a window of an hour to check if the amount of requests exceeds a pre-defined number | | 429 Too Many Requests | The maximum amount of allowable calls has been reached for this API request. The current API rate limiter uses a window of an hour to check if the amount of requests exceeds a pre-defined number. Currently, this number is set to a maximum of 10 requests per action. |
| 500 Unexpected Error | An unexpected error has occurred. | | 500 Unexpected Error | An unexpected error has occurred. |
### Examples ### Examples
... The most common library in Python to make API requests is the library [`requests`](https://docs.python-requests.org/en/latest/). The requests library isn’t part of the standard Python library, so you’ll need to install it to get started.
\ No newline at end of file
If you use pip to manage your Python packages, you can install requests using the following command:
```
pip install requests
```
```python
import requests
URL = "https://portal.robotsindeklas.nl/API/v1"
data_auth = {
"username": "example",
"password": "verySecure101",
"domain": "API School"
}
response = requests.post(f"{URL}/auth/getToken", data=data_auth)
result = response.json()
token = result["token"] # Get the bearer token from the json
data_app = {
"name": "Demo app",
"type": "code"
}
headers = {
"Authorization": f"Bearer {token}"
}
response = requests.post(f"{URL}/app/create", data=data_app, headers=headers)
result = response.json()
app_id = result["_id"] # Get the app id
print("App was successfully created!")
```
\ No newline at end of file
Clone repository
  • App API
  • Folder API
  • Group API
  • Robot API
  • User API
  • Home