Skip to content

Commit e13c1ed

Browse files
Merge pull request #240 from everypinio/feature/sc_integration_doc
StandCloud API key integration
2 parents 575498a + fdd54a0 commit e13c1ed

File tree

8 files changed

+93
-808
lines changed

8 files changed

+93
-808
lines changed

docs/examples/stand_cloud_thirdparty_auth.md

Lines changed: 0 additions & 535 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# StandCloud third party integration
2+
3+
This documentation explains how to use the StandCloud integration service via an API key.
4+
Information on integration options with StandCloud can be found at
5+
https://standcloud.io/integration/api/v1/docs.
6+
7+
## Code example
8+
9+
The code samples are in Python, but they use simple constructs that are available in
10+
most programming languages.
11+
12+
## Integration example
13+
14+
**integration_flow.py** is an example of a simple integration script written in Python.
15+
The script requires the installation of the `requests` package.
16+
The only thing that needs to be changed to make it work is the
17+
**API key** in the `API_KEY` variable.
18+
This script first checks access to the integration service,
19+
and then requests a list of completed test runs by sending a request to `test_run`.
20+
21+
22+
```python
23+
import sys
24+
25+
import requests
26+
27+
SSL_VERIFY = True
28+
29+
########################################
30+
# Change API_KEY to your api key
31+
API_KEY = "your_api_key"
32+
########################################
33+
34+
HEALTHCHECK_URL = "https://standcloud.io/integration/api/v1/healthcheck"
35+
response = requests.get(HEALTHCHECK_URL, verify=SSL_VERIFY)
36+
37+
if response.status_code != 200:
38+
print(response.text)
39+
sys.exit(1)
40+
print("StandCloud is up and running")
41+
42+
# Test API call
43+
header = {
44+
"Authorization": f"Bearer {API_KEY}",
45+
"Content-type": "application/json",
46+
"Accept": "text/plain",
47+
}
48+
49+
USER_INFO_URL = "https://standcloud.io/integration/api/v1/test_run"
50+
response = requests.get(USER_INFO_URL, headers=header, verify=SSL_VERIFY)
51+
52+
if response.status_code != 200:
53+
print(response.text)
54+
sys.exit(1)
55+
print("\nTest run list: ", response.text)
56+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# StandCloud third party integration
2+
3+
Example documentation: https://everypinio.github.io/hardpy/examples/stand_cloud_thirdparty_integration/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import sys
2+
3+
import requests
4+
5+
SSL_VERIFY = True
6+
7+
########################################
8+
# Change API_KEY to your api key
9+
API_KEY = "your_api_key"
10+
########################################
11+
12+
HEALTHCHECK_URL = "https://standcloud.io/integration/api/v1/healthcheck"
13+
response = requests.get(HEALTHCHECK_URL, verify=SSL_VERIFY)
14+
15+
if response.status_code != 200:
16+
print(response.text)
17+
sys.exit(1)
18+
print("StandCloud is up and running")
19+
20+
# Test API call
21+
header = {
22+
"Authorization": f"Bearer {API_KEY}",
23+
"Content-type": "application/json",
24+
"Accept": "text/plain",
25+
}
26+
27+
USER_INFO_URL = "https://standcloud.io/integration/api/v1/test_run"
28+
response = requests.get(USER_INFO_URL, headers=header, verify=SSL_VERIFY)
29+
30+
if response.status_code != 200:
31+
print(response.text)
32+
sys.exit(1)
33+
print("\nTest run list: ", response.text)

examples/stand_cloud_thirdparty_auth/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/stand_cloud_thirdparty_auth/auth_flow.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

examples/stand_cloud_thirdparty_auth/token_update.py

Lines changed: 0 additions & 190 deletions
This file was deleted.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ nav:
8181
- Skip test: examples/skip_test.md
8282
- StandCloud: examples/stand_cloud.md
8383
- StandCloud read data: examples/stand_cloud_reader.md
84-
- StandCloud third party authorization: examples/stand_cloud_thirdparty_auth.md
84+
- StandCloud third party integration: examples/stand_cloud_thirdparty_integration.md
8585
- Stand equipment: examples/stand_equipment.md
8686
- About:
8787
- Development: about/development.md

0 commit comments

Comments
 (0)