Skip to content
This repository was archived by the owner on Sep 17, 2022. It is now read-only.

Commit df84c49

Browse files
committed
Updated reference docs
1 parent f6e39a1 commit df84c49

File tree

2 files changed

+52
-39
lines changed

2 files changed

+52
-39
lines changed

docs/cloud/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,25 @@ APId cloud runs in multiple reagions worldwide. Here is a list of the current on
3939
| eu-north | Sweden |
4040
| eu-central | Germany |
4141
| sa-east | Brazil |
42+
43+
## Timeouts
44+
45+
The execution timeout is set to 30 seconds. If your API does not respond within that time an error is returned.
46+
47+
## Billing
48+
49+
We've tried making the billing model as simple as possible. Each account has a quota of units they can use each month for running their tests on the cloud infrastructure.
50+
51+
Each unit corresponds to 100ms of execution time of a step - thus the response time of the API for each step.
52+
53+
You are not billed for any interpolation or step preparation (which is done on the machine you're running the CLI on).
54+
55+
### Examples
56+
57+
| API response time | Units billed |
58+
| :---------------- | :----------- |
59+
| 23 | 1 |
60+
| 99 | 1 |
61+
| 100 | 1 |
62+
| 105 | 2 |
63+
| 1999 | 20 |

docs/reference.md

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ These will contain anything environment variable that the APId CLI has inherited
2828

2929
```yaml
3030
variables:
31-
title: 'A long time ago'
32-
subtitle: 'in a {{ var.place }} far far away {{ env.DATABASE_USER }} accidentally dropped all tables'
31+
title: "A long time ago"
32+
subtitle: "in a {{ var.place }} far far away {{ env.DATABASE_USER }} accidentally dropped all tables"
3333
year: 2187
3434
```
3535
@@ -61,7 +61,7 @@ use `{% echo $STEP_ONE_AUTH_TOKEN %}`. Another example might be `{{ var.my-name
6161
```yaml
6262
steps:
6363
request:
64-
endpoint: '{{ var.api_url }}/avengers/{% curl https://dynamic-avengers-api.io/random-avenger-id %}'
64+
endpoint: "{{ var.api_url }}/avengers/{% curl https://dynamic-avengers-api.io/random-avenger-id %}"
6565
```
6666

6767
## Configuration files
@@ -85,14 +85,14 @@ A transaction is a list of [steps](reference.md#step) which are executed sequent
8585
| matrix | [`matrix`](reference.md#matrix) | no | Variable matrix to repeat the transaction with |
8686

8787
```yaml
88-
id: 'transaction-one'
88+
id: "transaction-one"
8989
variables:
90-
api_url: 'https://jsonplaceholder.typicode.com'
90+
api_url: "https://jsonplaceholder.typicode.com"
9191
steps:
92-
- id: 'todos-1'
92+
- id: "todos-1"
9393
request:
94-
method: 'GET'
95-
endpoint: '{{ var.api_url }}/todos/1'
94+
method: "GET"
95+
endpoint: "{{ var.api_url }}/todos/1"
9696
```
9797

9898
### Matrix
@@ -106,16 +106,16 @@ The below will send four different requests in four different transactions.
106106
id: transaction
107107
matrix:
108108
api_url:
109-
- 'http://localhost:8080'
110-
- 'https://jsonplaceholder.typicode.com'
109+
- "http://localhost:8080"
110+
- "https://jsonplaceholder.typicode.com"
111111
todo_id:
112112
- 1
113113
- 2
114114
steps:
115115
- id: todos
116116
request:
117117
method: GET
118-
endpoint: '{{ var.api_url }}/todos/{{ var.todo_id }}'
118+
endpoint: "{{ var.api_url }}/todos/{{ var.todo_id }}"
119119
```
120120

121121
The different transactions and requests:
@@ -140,16 +140,16 @@ A step is a call to a single endpoint with optional validation of the response.
140140

141141
```yaml
142142
steps:
143-
- id: 'get user with id 1'
143+
- id: "get user with id 1"
144144
variables:
145-
api_url: 'http://localhost:80'
145+
api_url: "http://localhost:80"
146146
request:
147-
method: 'GET'
148-
endpoint: '{{ var.api_url }}/users/1'
147+
method: "GET"
148+
endpoint: "{{ var.api_url }}/users/1"
149149
expect:
150150
code: 200
151151
body:
152-
type: 'json'
152+
type: "json"
153153
content: |
154154
{
155155
"first_name": "Bobby",
@@ -160,8 +160,8 @@ steps:
160160
}
161161
}
162162
export:
163-
auth_header: 'response.headers.X-APIDAUTH'
164-
auth_token: 'response.body.access_token'
163+
auth_header: "response.headers.X-APIDAUTH"
164+
auth_token: "response.body.access_token"
165165
```
166166

167167
### Request
@@ -192,17 +192,17 @@ request:
192192

193193
Expect will define what we are expecting as a valid response from the API.
194194

195-
| Field | Type | Required | Description |
196-
| :------ | :------------------------ | :------- | :------------------------------ |
197-
| code | int | no | The status code of the response |
198-
| headers | mapping | no | What headers to expect |
199-
| body | [body](reference.md#body) | no | What body to expect |
195+
| Field | Type | Required | Description |
196+
| :------ | :-------------------------- | :------- | :------------------------------ |
197+
| code | int | no | The status code of the response |
198+
| headers | mapping | no | What headers to expect |
199+
| body | [[]body](reference.md#body) | no | What body to expect |
200200

201201
```yaml
202202
expect:
203203
code: 200
204204
headers:
205-
Accept: 'application/json'
205+
Accept: "application/json"
206206
```
207207

208208
#### Body
@@ -221,21 +221,12 @@ On the other hand, if `type` is `string` and `exact` is:
221221
- `true`: will perform an equals comparison.
222222
- `false`: will check if the provided `body` is a substring of the responses body.
223223

224-
| Field | Type | Required | Description |
225-
| :------ | :----- | :------- | :------------------------------------------------- |
226-
| type | enum | no | The type of the response, either `json` or `string` |
227-
| content | string | no | What content of the body to expect |
228-
| exact | bool | no | Is this the entire body, or a part of it |
229-
230-
```yaml
231-
body:
232-
type: 'json'
233-
exact: true
234-
content: |
235-
{
236-
"name": "John Doe"
237-
}
238-
```
224+
| Field | Type | Required | default | Description |
225+
| :------- | :----- | :------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
226+
| is | string | yes | | What content of the body (or selector content) to expect |
227+
| selector | string | no | - | A selector to get part of the body. The underlying implementation is using `gjson`, reference of syntax can be found [here](https://github.com/tidwall/gjson/blob/master/SYNTAX.md) |
228+
| subset | bool | no | no | If the `is` block is a subset of the body (or selector content). See [examples](../../testapi/tests). |
229+
| keysOnly | bool | no | no | If values should be disregarded when checking for equality. All types of values except objects are ignored. Objects will still be recursively checked. See [examples](../../testapi/tests). |
239230

240231
## Skip SSL verification
241232

0 commit comments

Comments
 (0)