import requests
import json
import jsonpath

#API URL
url = "http://reqres.in/api/users/2"

#Read input json file
file = open("/Users/hiralsuthar1/Project/PythonRef/Complete-Python-Bootcamp/APIAutomation/Resources/create1.json")
json_input = file.read()
requests_json = json.loads(json_input)
print(requests_json)

response = requests.put(url, requests_json)
print(response.content)

assert response.status_code == 200

#Fetch Header
print(response.headers.get('Content-Type'))

#parse response to json format
response_json = json.loads(response.text)

#pick id using json path
updatedAt = jsonpath.jsonpath(response_json, 'updatedAt')
print(updatedAt[0])
a928fa77a4a91cde8549b22ee7e349db3e72c2f3
<mask token>

<mask token>
print(requests_json)
<mask token>
print(response.content)
assert response.status_code == 200
print(response.headers.get('Content-Type'))
<mask token>
print(updatedAt[0])

<mask token>
url = 'http://reqres.in/api/users/2'
file = open(
    '/Users/hiralsuthar1/Project/PythonRef/Complete-Python-Bootcamp/APIAutomation/Resources/create1.json'
    )
json_input = file.read()
requests_json = json.loads(json_input)
print(requests_json)
response = requests.put(url, requests_json)
print(response.content)
assert response.status_code == 200
print(response.headers.get('Content-Type'))
response_json = json.loads(response.text)
updatedAt = jsonpath.jsonpath(response_json, 'updatedAt')
print(updatedAt[0])

import requests
import json
import jsonpath
url = 'http://reqres.in/api/users/2'
file = open(
    '/Users/hiralsuthar1/Project/PythonRef/Complete-Python-Bootcamp/APIAutomation/Resources/create1.json'
    )
json_input = file.read()
requests_json = json.loads(json_input)
print(requests_json)
response = requests.put(url, requests_json)
print(response.content)
assert response.status_code == 200
print(response.headers.get('Content-Type'))
response_json = json.loads(response.text)
updatedAt = jsonpath.jsonpath(response_json, 'updatedAt')
print(updatedAt[0])

import requests
import json
import jsonpath

#API URL
url = "http://reqres.in/api/users/2"

#Read input json file
file = open("/Users/hiralsuthar1/Project/PythonRef/Complete-Python-Bootcamp/APIAutomation/Resources/create1.json")
json_input = file.read()
requests_json = json.loads(json_input)
print(requests_json)

response = requests.put(url, requests_json)
print(response.content)

assert response.status_code == 200

#Fetch Header
print(response.headers.get('Content-Type'))

#parse response to json format
response_json = json.loads(response.text)

#pick id using json path
updatedAt = jsonpath.jsonpath(response_json, 'updatedAt')
print(updatedAt[0])