Hello guys, welcome to success in all the VBA tutorials. In a previous lesson we are retrieving the data from the database. And in this session we are going to add the new data into the our database or we should research studio creating the new method for the post which take the which will take the product from the body and we need to use the trackers below. Using statement for the product entities. Within that using segment we're going to add the product in the products entity by using the Add method and specify the name of the object that is a protocol which come from the parameter in the body. And we need to see the changes into the database.
Now I'm going to write I'm going to copy the JSON format. change to the data array more parameter, click on body grow. csv the tison restrict, which does not need to specify the product ID. It should append I'm going to specify the ink of the quantity file boxes will be then so we'll be touching. Click on the send button. You can see that it returned to you 204 status, which means it does not show any content.
Now going to reload your database You can see that he did the euro. For our ng has for the Euro shadow, we need to record it and the 201 status code when the Our product is inserted and the return the product detail itself, as well as we need to return the location in the header from which it can be directly access setting that we need to switch to the Visual Studio. Instead of returning void we need to return the asset EP response message. We need to create the instance of the HTTP response message. says message equal to request dot query to response the Commissioner's court created which transport 201 and your protocol protect itself. We also need to specify the location where it can be accessible.
For that we need to add the header in the message object, message dot headers, but bless a dot headers dot block isn't equal to new UI request Request ui plus the product object, God, it's a product ID not pushing. And when we need to return our message that is our response with the HTTP status code, match request and do it accepts an object itself. We also need to return that message, but I forgot it. Click on do On Shree, stop watchmen and change you name that is a marker, it's quantity a product and boxes will be same. And I'm going to click on the send button. You can see that it written the status code 201 that is a created and the our entire product object, which also include the product ID itself.
That is eight. You can see that within the database, it will be eight. In this lesson, we'll learn how to how to use Do a POST request to add the data in the database. And here is a call to adding the new element in the database. Thanks for watching. If you have any doubt, please contact me