Hi, my name is Ashish. And I welcome you to this video in which we will see how to mock API responses in his API Management instance. So let me just quickly log on to the portal and take it from there. I am logged on to the portal and you see my API here. What happens is back end API's can be imported into an Azure Portal, API Management instance, are created and managed manually. So when the API factory is designed first, and the backend implementation comes later, or the back end is being developed in parallel.
So in this video, we will create a test API, add an operation to the test API, enable response mocking test the mock API. So let me just create a test API here. I go to my API section. I click on bank API and the display name You would see test API. The name is test API web service URL would be base URL is test comm full. Tags is nothing product.
I'm going to go with unlimited base URL with this create a blank a PMP. To search click on Create. Let's wait for it to complete. I can have my test API here. Now I will add an operation to my test API. under test API, click on Add operation.
Display name would be anything like in test call and there is one drop down query responses, click on response. Click on Add a response under this pond I'm going to go with 200. Okay representations Click on Add representation. content types you can skip it, you can do it I'm sorry, I missed a URL here. Let me create the representation I give you a comeback. And the application JSON is the content type into the representation.
The sample would be in a drop town if you would select a gun slave This is the API that was created know if you would see the response, a mocking. And if you would see here, under the inbound processing under your test API, click on Add a policy and click on mock response. When saved, so in the know if you will test the mock API, you click on this is your test API, click on test. click on Send. mocking is enabled guest at guest HTTPS. This is my test, API base URL.
And the host is this. It is sending the query to my back end and the response that is coming in is is this and if you would trace The request API inspector would getting the URL from here. It is the get method. And it is a test call. If you see from here, and if you would see the back end, MT is this outbound. And here, this is the back end of the original request.
So this is how you do the mocking for the API. Oh, hi, hope you liked this video. I'll see you guys in the next video. Till then. Have a good day. Bye.