Skip to content

Commit fceb72a

Browse files
committed
Add scanapi-demo example
1 parent 7a2c3bf commit fceb72a

File tree

5 files changed

+906
-0
lines changed

5 files changed

+906
-0
lines changed

scanapi-demo/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export BASE_URL="http://demo.scanapi.dev/api/"
2+
export DEMO_KEY="demoKEY123"

scanapi-demo/.scanapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
report:
2+
hide-request:
3+
headers:
4+
- x-api-key

scanapi-demo/api.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
api:
2+
endpoints:
3+
- name: scanapi-demo
4+
path: ${BASE_URL}
5+
requests:
6+
- name: health
7+
method: get
8+
path: /health/
9+
- name: languages
10+
method: get
11+
path: /languages/
12+
endpoints:
13+
- name: devs
14+
path: /devs/
15+
requests:
16+
- name: list_all
17+
method: get
18+
vars:
19+
uuid: ${{response.json()[2]["uuid"]}}
20+
- name: looking_for_new_opportunities
21+
method: get
22+
params:
23+
newOpportunities: true
24+
- name: not_looking_for_new_opportunities
25+
method: get
26+
params:
27+
newOpportunities: false
28+
- name: new
29+
method: post
30+
headers:
31+
x-api-key: ${DEMO_KEY}
32+
body:
33+
uuid: ${{uuid.uuid4().hex}}
34+
name: Tarik
35+
yearsOfExperience: 2
36+
languages:
37+
- ruby
38+
go
39+
newOpportunities: false
40+
- name: details_not_found
41+
path: 129e8cb2-d19c-51ad-9921-cea329bed7fa
42+
method: get
43+
endpoints:
44+
- name: details
45+
path: ${uuid}
46+
requests:
47+
- name: get
48+
method: get
49+
- name: delete
50+
method: delete
51+
headers:
52+
x-api-key: ${DEMO_KEY}
53+
- name: languages
54+
path: languages
55+
method: get

scanapi-demo/scanapi-report.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!doctype html>
2+
3+
<html lang="en">
4+
<head>
5+
<meta charset="utf-8">
6+
7+
<title>ScanAPI Report</title>
8+
<meta name="description" content="ScanAPI Report">
9+
<meta name="author" content="camilamaia/scanapi">
10+
</head>
11+
12+
<body>
13+
<div>
14+
<h2>GET http://demo.scanapi.dev/api/health/</h2>
15+
<p>200</p>
16+
</div>
17+
<div>
18+
<h2>GET http://demo.scanapi.dev/api/languages/</h2>
19+
<p>200</p>
20+
</div>
21+
<div>
22+
<h2>GET http://demo.scanapi.dev/api/devs/</h2>
23+
<p>200</p>
24+
</div>
25+
<div>
26+
<h2>GET http://demo.scanapi.dev/api/devs/?newOpportunities=True</h2>
27+
<p>200</p>
28+
</div>
29+
<div>
30+
<h2>GET http://demo.scanapi.dev/api/devs/?newOpportunities=False</h2>
31+
<p>200</p>
32+
</div>
33+
<div>
34+
<h2>POST http://demo.scanapi.dev/api/devs/</h2>
35+
<p>201</p>
36+
</div>
37+
<div>
38+
<h2>GET http://demo.scanapi.dev/api/devs/129e8cb2-d19c-51ad-9921-cea329bed7fa</h2>
39+
<p>404</p>
40+
</div>
41+
<div>
42+
<h2>GET http://demo.scanapi.dev/api/devs/129e8cb2-d19c-41ad-9921-cea329bed7f0</h2>
43+
<p>200</p>
44+
</div>
45+
<div>
46+
<h2>DELETE http://demo.scanapi.dev/api/devs/129e8cb2-d19c-41ad-9921-cea329bed7f0</h2>
47+
<p>200</p>
48+
</div>
49+
<div>
50+
<h2>GET http://demo.scanapi.dev/api/devs/129e8cb2-d19c-41ad-9921-cea329bed7f0/languages</h2>
51+
<p>200</p>
52+
</div>
53+
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)