Saturday, October 1, 2022

API Testing 08: How to send POST request in REST-assured?

POST is a http method, it is used for creating the new resources on the server. In particular, it is used for creating the subordinate resources.

When we POST the request, the service will associate the new resource with the parent resource assigning an ID. On successful creation of new resource the request returns a location header with link to newly created header and HTTP status code 201 (created). 

POST request consists of request line, headers and body/payload. The body/payload can be of different types like Simple Object (String, Map, JsonObject), File and Model (POJO). In this tutorial we will send the payload as simple object (String). Please check the below code.

Please find the execution in below video.


Hope this post gave you an understanding on how to send post request. Thank you! #happytesting #qababuworks

1 comment:

  1. Car glass repair is something that most car owners will need at some point in their vehicle's life. Windshields are an essential component of a car and are crucial to a driver's safety on the road. In this blog post, we will discuss why car glass repair is important, how to identify damage, and what to do if you need repairs.
    Importance of Car Glass Repair
    The windshield of a car serves several purposes, including protecting drivers and passengers from the elements and providing structural support to the vehicle. A damaged windshield can compromise the safety of the vehicle and its occupants. In the event of an accident, a damaged windshield may not be able to provide adequate protection, leading to more severe injuries.
    Identifying Damage
    There are several ways to identify damage to a windshield. Chips and cracks are the most common types of damage. Chips are small dents on the windshield caused by rocks or other debris. They are usually small and do not require the windshield to be replaced. Cracks, on the other hand, are more severe and can spread across the windshield if not repaired in a timely manner. Scratches are also a common type of damage, but they are usually minor and do not require repair.
    What to Do if You Need Repairs
    If you notice any damage to your windshield, it is essential to take action immediately. Even small chips and cracks can quickly become larger and more dangerous. In some cases, small chips can be repaired with a resin injection. However, more significant damage may require a full windshield replacement. It is always best to seek professional help when it comes to car glass repair.
    Final Thoughts
    Car glass repair is a vital aspect of vehicle maintenance that should not be ignored. Any damage to the windshield can compromise the safety of the vehicle and its occupants. If you notice any chips, cracks, or scratches on your windshield, seek professional help immediately. By taking care of your windshield, you can ensure safe driving and prevent more significant damages in the long run.

    ReplyDelete

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...