(Tcl) HTTP DELETE with Body
Demonstrates how to send a DELETE request with a body. Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set success 0
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
set requestBody "{ \"abc\": 123 }"
set resp [new_CkHttpResponse]
set success [CkHttp_HttpStr $http "DELETE" "https://example.com/something" $requestBody "utf-8" "application/json" $resp]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkHttpResponse $resp
exit
}
puts "Response status: [CkHttpResponse_get_StatusCode $resp]"
puts "Response body: "
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttp $http
delete_CkHttpResponse $resp
|