diff --git a/config.toml b/config.toml index 7da9aad..98fb0ee 100644 --- a/config.toml +++ b/config.toml @@ -1681,3 +1681,24 @@ theme = "doc-theme" url="/license/" identifier="license" weight = 500 + +[[menu.main]] + name = "Open API" + url = "/pybytes/open-api/" + identifier = "pybytes@open-api" + parent = "pybytes" + weight = 50 + +[[menu.main]] + name = "Starting with Open-API" + url = "/pybytes/open-api/gettingstartedopenapi/" + identifier = "pybytes@open-api@gettingstartedopenapi" + parent = "pybytes@open-api" + weight = 10 + +[[menu.main]] + name = "Playground" + url = "/pybytes/open-api/playground/" + identifier = "pybytes@open-api@playground" + parent = "pybytes@open-api" + weight = 20 diff --git a/content/pybytes/open-api/_index.md b/content/pybytes/open-api/_index.md new file mode 100644 index 0000000..91d5492 --- /dev/null +++ b/content/pybytes/open-api/_index.md @@ -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. \ No newline at end of file diff --git a/content/pybytes/open-api/gettingstartedopenapi.md b/content/pybytes/open-api/gettingstartedopenapi.md new file mode 100644 index 0000000..f69099a --- /dev/null +++ b/content/pybytes/open-api/gettingstartedopenapi.md @@ -0,0 +1,34 @@ +### Creating Personal Access Token (PAT) + +1. Log into [Pycom](https://sso.pycom.io/) and go to the Account Settings. + +![](/gitbook/assets/open-api/token/login-settings.png) + + + +2. Open the Token tab and add a new Token. + +![](/gitbook/assets/open-api/token/token-page.png) + + + +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. + +![](/gitbook/assets/open-api/token/token-settings.png) + + + +### 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. + +![](/gitbook/assets/open-api/token/token-security.png) + + diff --git a/content/pybytes/open-api/playground.md b/content/pybytes/open-api/playground.md new file mode 100644 index 0000000..50dc61e --- /dev/null +++ b/content/pybytes/open-api/playground.md @@ -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. +![](/gitbook/assets/open-api/graphql/open-api-graphql.png) + +### 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 +![](/gitbook/assets/open-api/graphql/graphql-headers.png) + + +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 + +![](/gitbook/assets/open-api/graphql/graphql-play.png) \ No newline at end of file diff --git a/static/gitbook/assets/open-api/graphql/graphql-headers.png b/static/gitbook/assets/open-api/graphql/graphql-headers.png new file mode 100644 index 0000000..3497e98 Binary files /dev/null and b/static/gitbook/assets/open-api/graphql/graphql-headers.png differ diff --git a/static/gitbook/assets/open-api/graphql/graphql-play.png b/static/gitbook/assets/open-api/graphql/graphql-play.png new file mode 100644 index 0000000..b3b2fd3 Binary files /dev/null and b/static/gitbook/assets/open-api/graphql/graphql-play.png differ diff --git a/static/gitbook/assets/open-api/graphql/open-api-graphql.png b/static/gitbook/assets/open-api/graphql/open-api-graphql.png new file mode 100644 index 0000000..fad3cba Binary files /dev/null and b/static/gitbook/assets/open-api/graphql/open-api-graphql.png differ diff --git a/static/gitbook/assets/open-api/token/login-settings.png b/static/gitbook/assets/open-api/token/login-settings.png new file mode 100644 index 0000000..7ee530f Binary files /dev/null and b/static/gitbook/assets/open-api/token/login-settings.png differ diff --git a/static/gitbook/assets/open-api/token/sso-frontpage.png b/static/gitbook/assets/open-api/token/sso-frontpage.png new file mode 100644 index 0000000..aa7a20d Binary files /dev/null and b/static/gitbook/assets/open-api/token/sso-frontpage.png differ diff --git a/static/gitbook/assets/open-api/token/token-page.png b/static/gitbook/assets/open-api/token/token-page.png new file mode 100644 index 0000000..5f9d167 Binary files /dev/null and b/static/gitbook/assets/open-api/token/token-page.png differ diff --git a/static/gitbook/assets/open-api/token/token-security.png b/static/gitbook/assets/open-api/token/token-security.png new file mode 100644 index 0000000..ba7e8df Binary files /dev/null and b/static/gitbook/assets/open-api/token/token-security.png differ diff --git a/static/gitbook/assets/open-api/token/token-settings.png b/static/gitbook/assets/open-api/token/token-settings.png new file mode 100644 index 0000000..73e2125 Binary files /dev/null and b/static/gitbook/assets/open-api/token/token-settings.png differ