Star

Created With

linkRequest Path Parameters

Modify the URL by specifying parameters to plug into the path, either hard-coded or dynamically.

linkBasic Example

1linkconfiguration:

2link host: api.mycompany.com

3link scheme: https

4link base_path: /api

5linkspecs:

6link - request:

7link path: /users/{userId}/addresses/{addressId}

8link method: get

9link path_params:

10link - name: userId

11link value: 4

12link - name: addressId

13link value: 1

14link response:

15link status_code: 200

16link# GET https://api.mycompany.com/users/4/addresses/1

See also: Example: Suite Using Query Params



linkDynamically Set Query Parameters

Dynamic query params can be added by setting path_params as an object to the this.test context:

1linkconfiguration:

2link host: api.mycompany.com

3link scheme: https

4link base_path: /api

5linkspecs:

6link - before_test:

7link run_type: inline

8link inline:

9link function: !!js/function >

10link function () {

11link this.test.path_params = {

12link userId: 4,

13link addressId: 1

14link };

15link }

16link request:

17link path: /users/{userId}/addresses/{addressId}

18link method: get

19link response:

20link status_code: 200

21link# GET https://api.mycompany.com/users/4/addresses/1

See also: Overview of Hooks



Request Path ParametersBasic ExampleDynamically Set Query Parameters

Home

Getting Startedchevron_right
Basicschevron_right
Requestchevron_right

Request Basics Headers Cookies Query Parameters Path Parameters

Payload Bodychevron_right

File Uploads Auto-Retry Additional Options

Response Validationchevron_right

Overview

Assertionschevron_right

Status Code Headers & Cookies

Bodychevron_right
Hooks & JSchevron_right

Overview

Function Typeschevron_right
Suite-Level Hookschevron_right
Spec-Level Hookschevron_right
Contextchevron_right
DRY & Reusing Specschevron_right
Command Line Interface (CLI)chevron_right