Hello guys, welcome to the trading session OBS we don't need a VBA to. In this session we will learn about the how to customize the method name. By default the HTTP verb will match to the method name in a controller that has the same name or the shot with the verb. means that the method with dnm CAD get product get our product will match to the HTTP verb get. And the meta name post and post product will match to the editor we will post but what if you want to use the different name for the method for example, instead of using the product name for the matter you want to use the load or products for the mF and that will map to the ITV get legendary should with the examples we should visit studio. Let's modify the get method name to the old all products and build our solution switch to postman.
Remove the unnecessary parameters and send the get request to retrieve all of the products. You can see that the request has is a four zero file that is a method not allowed. This error occur because the as we don't have baby pay we'll try to find the a method with the name get or start with the gap which does not have the any parameter. In the our case there is only one good method however it contained the parameter so it does not map to that and it will enter the 405 method. We need to specify the VPI that our lower product method will be used as the get method. For that we need to use the follies we need to use the ITP get attribute.
Let's rebuild the solution. Switch to postman and click on the Send request. You can see that it written all of the product as the expected. Like the HTTP GET attribute, we can also use the HTTP POST put and delete attribute for the respected methods. Along with that, we can also use the acceptable attribute which allows us to specify the multiple HTTP methods. Let's see.
Instead of using the cat as a method name, I am going to use the load product with ID has a method name and use the Accept for attribute and specify the list of the Did we matter let us the I get as well as the post, but it will be of a solution. Switch to postman. Specify the ID that is a 10. Click on DSN to ensure that it will return the product detail with the target matter. And now we're going to select the post and click on the yes and it also written the detailing the apportion method to we need to specify the attribute at the method level. We can use the HTTP GET post, put and delete as well as the except for in which we need to specify the method name.
Thanks for watching. Have a nice day.