mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 03:04:13 +01:00
Open-api documentation (#447)
* chore: files creation * fix: getting started double files * chore: filling the page * fix: playground page * fix: open-api page with screenshot * fix:playground authentification * fix: capabilities to scope * fix: change based on bettina and kateryna reviews * fix: after ahmad review
This commit is contained in:
12
content/pybytes/open-api/_index.md
Normal file
12
content/pybytes/open-api/_index.md
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "Pybytes Open-API"
|
||||
aliases:
|
||||
---
|
||||
|
||||
The Pybytes Open APIs help you to get access to the devices, the projects, and their releases outside the Pybytes.
|
||||
|
||||
With Open APIs you can access and transfer data related to your **Devices**, **Network Settings**, **Projects** and **Releases**.
|
||||
|
||||
Open APIs use Tokens [as described below](https://docs.pycom.io/pybytes/open-api/gettingstartedopenapi/).
|
||||
|
||||
Your Token’s Scope level may enable you to modify the data itself.
|
||||
34
content/pybytes/open-api/gettingstartedopenapi.md
Normal file
34
content/pybytes/open-api/gettingstartedopenapi.md
Normal file
@@ -0,0 +1,34 @@
|
||||
### Creating Personal Access Token (PAT)
|
||||
|
||||
1. Log into [Pycom](https://sso.pycom.io/) and go to the Account Settings.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
2. Open the Token tab and add a new Token.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
3. In the Add Token modal window, you have to select the **scopes** which you would like to access with the Pybytes Open APIs.
|
||||
|
||||
|
||||
### Capabilities
|
||||
You will have the choice between different access level.
|
||||
You will also need to select a Read-only or Write-only accessibility level for each data type.
|
||||
You may set the **Read** and **Write** Scope for a **User**, **Devices**, **Network Settings**, **Projects** or
|
||||
**Releases**.
|
||||
This will determine what a User, Device, Network, Setting, Project or Release can and can't do when logged in with the particular Token.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
### Security
|
||||
Bear in mind! Each **Token** is unique and can be exposed only once after generation. So be sure that you copied the Token and saved it. Otherwise, you would need to repeat the creation of the PAT again.
|
||||
|
||||

|
||||
|
||||
|
||||
35
content/pybytes/open-api/playground.md
Normal file
35
content/pybytes/open-api/playground.md
Normal file
@@ -0,0 +1,35 @@
|
||||
### The Playground
|
||||
|
||||
You can access the Open APIs playground following this link **https://open-api.pybytes.pycom.io/graphql**.
|
||||
This GraphQL interface will help you to test the Pybytes Open APIs.
|
||||
|
||||
Under the **DOCS tab** on the right part of the screen, you will find the list of Open APIs.
|
||||
Under the **SCHEMA tab**, you will learn the general Scheme for the Pybytes Open APIs.
|
||||
|
||||
If you want to get more information about precesses in GraphQL, please, visit this [link](https://graphql.org/learn/).
|
||||
|
||||
This interface is a place where you can test the API without setting the environment.
|
||||
**Queries** and **Mutations** will already be at your disposal to be used and tested.
|
||||

|
||||
|
||||
### How to test Open APIs
|
||||
|
||||
First of all, you should authorize with the token that you saved during the [previous step](https://docs.pycom.io/pybytes/open-api/gettingstartedopenapi/).
|
||||
|
||||
1. On the playground open the HTTP Headers tab at the bottom of the screen
|
||||

|
||||
|
||||
|
||||
2. Past the token string following this format
|
||||
|
||||
{
|
||||
|
||||
"Authorization": " Bearer your Token"
|
||||
|
||||
}
|
||||
|
||||
|
||||
3. Now you can try to send the Query or Mutation request for a certain API function, for instance, getAllWifi query.
|
||||
After pressing the play **button** you will see the list of all wi-fi networks on the right frame of the playground
|
||||
|
||||

|
||||
Reference in New Issue
Block a user