Modify the URL by specifying parameters to plug into the path, either hard-coded or dynamically.
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
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