Modifying API Mocking Details
You must select Enable mocking from the API details page.
You can modify API mocking details, as required, from the API details page.
![*](icon_task_xpe.png)
To modify API mocking details
1. Click APIs in the title navigation bar.
A list of all registered APIs appears.
2. Click the required API.
The API details page appears.
3. Click Edit.
4. Click API mocking.
5. Specify the following information in the IS service section:
Field | Description |
Invoke service | Specifies the webMethods Integration Server service to be invoked. Note: The webMethods Integration Server service must be running on the same Integration Server as API Gateway. |
Run as user | Type the user name you want API Gateway to use to invoke the IS service. |
6. Select the operation that you want to modify from the Mocked responses section.
7. Click Add Response if you want to add a response and select the status code from the drop-down.
8. Click
. This adds the status code created to the existing status code list.
9. Select the status code you want to modify.
10. Click + Add Response Header and provide the following information to add the required response headers:
Field | Description |
Header key | Specify the HTTP header key that would be contained in the header of HTTP response. |
Header value | Specify the HTTP header value that would be contained in the header of HTTP response. |
You can add more response headers by clicking
![](../yai-webhelp/images/add.png)
.
11. Click + Add Content-type to add a content-type to the status code selected and provide the following information:
Field | Description |
Content type | Select the content-type to be added to the selected status code from the drop-down list. |
Mock payloads | Specify a mock response payload for the content-type selected. |
You can add more content-types by clicking
![](../yai-webhelp/images/add.png)
.
12. Click + Add Conditions to add a condition to the operation in the resource:
Field | Description |
Condition name | Specify the name for the condition. |
Condition parameter | Select the type to which the condition is to be applied. The available options are: Body Header Query parameter (Applicable only for REST APIs) |
Key | The key can be a string for the header and query parameter and for body it can be a JSON path or an XML path. |
Value | The value of the condition. Additionally, you can type an * (asterisk) to ignore the value specified in this parameter and the condition is satisfied based on the value specified in the Key parameter. |
Status code | Select the status code from the drop-down list. Note: ![*](chapterTOC_bullet.png) You must enable the property Send native provider fault in the Administration > General > API fault section in order to have correct mock response for status code 506. ![*](chapterTOC_bullet.png) While invoking an API remember to use the query parameter expectedStatusCode in order to have correct mock responses for status codes 100 and 202. |
+ Add Response Header | Add a response header to the resource selected by providing the following information: Header key. Specify the HTTP header key that would be contained in the header of HTTP response Header value. Specify the HTTP header value that would be contained in the header of HTTP response. |
+ Add Content-type | Add a content-type to the status code selected by providing the following information: Content type. Select the content-type to be added to the selected status code from the drop-down list. Mock payload. Specify a mock response payload for the content-type selected. |
You can add more conditions by clicking
![](../yai-webhelp/images/add.png)
.
13. Click Save.