Define Api Request Header Command: REQ_HEADER
The Define Api Request Header command is used to set a header for API service requests. This command allows you to include essential key-value pairs in the header, such as authorization tokens or content types, which are required for successful API communication.
Example: Suppose you need to include an Authorization token as a header to access a secured API endpoint. The header key is Authorization, and the corresponding value is Bearerabc123token.
Steps to Configure:
- Open the Case where you need to use this command.
- Add a new step at the required index.
- From the Action dropdown, select Define Api Request Header.
- In the Element Key field, specify the header key (e.g., Authorization).
- In the Parameters section, enter the corresponding value for the header key (e.g., Bearer abc123token).
- Click Save to complete the setup.
Note: While the steps for adding an action command are identical in both views, the display of the steps changes:


Notes:
- You should define all headers between Start Api Request and End The Api Call commands.
- It is recommended to define headers after Define Api Request Resource command to ensure the request is properly structured.
Example Workflow:
The following screenshot illustrates how the Define Api Request Header command is structured within an API test case in HuLoop.

Expected Outcome on execution:
- The specified header is successfully added to the API request.
- This ensures that the API request is sent with the required key-value pairs, facilitating accurate communication and testing of the API service.
- The headers can be validated or referenced in subsequent steps as needed.