Requests
Requests hold the actual data that is send to the API. A request has several fields;
- Body
- Authorization
- Parameters
- Headers
- Cookies
When you’ve added the host by importing it from a service definition, any new request will be filled with the required body, headers and parameters, specified by the service definition.
Body
The body of the API request holds data that is used by the API service. It can contain JSON, XML or other valid content types, which can be selected from a drop down box in JOSF.
content-types
Authorization
JOSF support the Basic Authentication method to authorize the API request to the service. This method can be selected from the Authorization tab. For Bearer Authentication, this works a little different. To add Bearer Authentication, add a new header and set this data;
- Key: Authorization
- Value: Bearer <token>
Replace the <token> with the actual bearer token value. How this token is received, differs per application.
Parameters
These are the query parameters in your API request. For example, if you have an API service like this;
http://www.my-api-service.com/api/user?id=10
the `id` and `10` are the parameter key and value. Add a new parameter and set this data;
- Key: id
- Value: 10
Headers
These are the header values that are sent with the request.
Cookies
These are the cookie values that are sent with the request.
Variables
Using variables within host, resource or request information is possible in any field. This makes reuse in test cases possible and easy. If you’ve added variables to any field, while executing the request, JOSF will ask you to fulfil any unset variables.
Responses
After executing a request, a response is shown in JOSF with exactly the same fields;
- Body
- Authorization
- Parameters
- Headers
- Cookies
In the Body tab, you can use a query language to find objects in the response body. If the response body is an XML message, XPath is used to query the body. If the body is a JSON message, JSONPath is used to query the body.