Skip to content

Commit 0df2fda

Browse files
committed
Add Quick Start page
1 parent ce6a1d2 commit 0df2fda

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

docs/3.-quick-start.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Quick Start
3+
hide_title: true
4+
---
5+
6+
To quickly start, let's try something live online.. [REQ|RES](https://reqres.in) is a hosted demo REST api service. Let's call a simple API endpoint from here.
7+
8+
> First [setup chkware](2.-Setup).
9+
10+
Go to https://reqres.in, and find there is an endpoint like **_GET_ SINGLE USER** we'll call this API with Chkware. So, follow these steps:
11+
12+
1. Create a file called `User.chk`.
13+
2. Put following content
14+
15+
```yaml
16+
---
17+
request:
18+
url: https://reqres.in/api/users/2
19+
method: GET
20+
```
21+
22+
3. from terminal run following
23+
24+
```bash
25+
$ chk User.chk
26+
```
27+
28+
See the output like
29+
30+
```text
31+
HTTP/1.1 200 OK
32+
Date: Sat, 29 Jan 2022 16:46:26 GMT
33+
Content-Type: application/json; charset=utf-8
34+
Transfer-Encoding: chunked
35+
...truncated-headers...
36+
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
37+
38+
{'data': {'id': 2, 'email': 'janet.weaver@reqres.in', 'first_name': 'Janet', 'last_name': 'Weaver', 'avatar': 'https://reqres.in/img/faces/2-image.jpg'}, 'support': {'url': 'https://reqres.in/#support-heading', 'text': 'To keep ReqRes free, contributions towards server costs are appreciated!'}}
39+
```
40+
41+
:wink::tada::confetti_ball:
42+
43+
---
44+
45+
Now let's try a more complex API. Let's call COVID-19 data from RapidAPI. You can call this api for any country with a two letter country code. Let's do the following to fetch covid-19 data for Bangladesh:
46+
47+
1. Register or login to https://rapidapi.com
48+
2. Subscribe to https://rapidapi.com/Gramzivi/api/covid-19-data/ this source.
49+
3. Create a directory called `~/project` and `covid-19.chk` in it
50+
4. Now open `covid-19.chk` file and add following data
51+
52+
```yaml
53+
---
54+
request:
55+
url: https://covid-19-data.p.rapidapi.com/report/country/code
56+
url_params:
57+
code: bd
58+
date: '2020-04-01'
59+
method: GET
60+
headers:
61+
X-RapidAPI-Host: 'covid-19-data.p.rapidapi.com'
62+
X-RapidAPI-Key: '<your X-RapidAPI-Key>'
63+
```
64+
65+
1. hit enter writing following command on terminal
66+
67+
```bash
68+
$ cd ~/project
69+
$ chk covid-19.chk
70+
```
71+
72+
1. You'll get output like this
73+
74+
```text
75+
HTTP/1.1 200 OK
76+
Cache-Control: no-cache, private
77+
Content-Type: application/json
78+
Date: Sun, 23 Jan 2022 04:28:35 GMT
79+
ETag: "69236d0ee4cbd7e37314028f0a8b01be"
80+
Server: RapidAPI-1.2.8
81+
Vary: Accept
82+
X-RapidAPI-Region: AWS - ap-southeast-1
83+
X-RapidAPI-Version: 1.2.8
84+
X-RateLimit-Requests-Limit: 50000
85+
X-RateLimit-Requests-Remaining: 49988
86+
X-RateLimit-Requests-Reset: 2175151
87+
Content-Length: 182
88+
Connection: keep-alive
89+
90+
[{'country': 'Bangladesh', 'provinces': [{'province': 'Bangladesh', 'confirmed': 54, 'recovered': 25, 'deaths': 6, 'active': 23}], 'latitude': 23.684994, 'longitude': 90.356331, 'date': '2020-04-01'}]
91+
```
92+
93+
:wink::tada::confetti_ball:
94+
95+
You just fetch a live API. Going further, you should save these `.chk` files in git repo, so that you can run it later, from anywhere where **chkware** is installed. Cheers.

0 commit comments

Comments
 (0)