Part 19 :DELETE Method Example REST API JSONPLACEHOLDER using Vscode Python requests library

Published: 18 June 2024
on channel: AppSmashers
374
3

Part 19 :DELETE Method Example REST API JSONPLACEHOLDER using vscode Python requests library
Example:
import requests
import json

urlpost='https://jsonplaceholder.typicode.com/...
bodypost={
'title': 'foo',
'body': 'bar',
'userId': 1
}

headerpost={'Content-type': 'application/json; charset=UTF-8'}
response=requests.post(url=urlpost,headers=headerpost,json=bodypost,)
status=response.status_code
print(status)
assert status==201
jsonObject=response.json()
print(jsonObject['id'])
print(jsonObject)

urlput='https://jsonplaceholder.typicode.com/...
responseput=requests.put(url=urlput,headers=headerpost,json=jsonObject,)
statusput=responseput.status_code
print(statusput)
print(responseput.json()['id'])
print(response.json())

urldelete='https://jsonplaceholder.typicode.com/...
response=requests.delete(url=urldelete,)
print(response.status_code)
assert response.status_code==200


On this page of the site you can watch the video online Part 19 :DELETE Method Example REST API JSONPLACEHOLDER using Vscode Python requests library with a duration of hours minute second in good quality, which was uploaded by the user AppSmashers 18 June 2024, share the link with friends and acquaintances, this video has already been watched 374 times on youtube and it was liked by 3 viewers. Enjoy your viewing!