API testing is widely used in any professional automation framework. API allows different software components to interact with each other. HTTP is one of the methods to make HTTP calls. PUT is one of the HTTP methods which is used when the user wants to UPDATE data on the server-side.
For automaton of PUT scenario, below steps are commonly used:
- Step 1: Read data from JSON File and parse into JSON format
- Step 2: Execute your Put Action
- Step 3: Parse Response in JSON Format and validate
- Step 4: Assert Response
Additionally, for making HTTP PUT request, below components are required to make a successful request:
- Request URL: Server URL where data needs to be updated.
- Request Headers: it contains Content-Type & Authorization Token
- Request Body: Data which will be sent with request
This can be implemented in automation script as a reusable method in following way:
data = dump.dump_all(response)