TsgcHTTP2ClientMethods › Delete

Delete Method

Performs a synchronous HTTP/2 DELETE to remove the resource identified by the URL.

Overloads

Overload 1

Syntax

function Delete(const aURL: string): string;

Parameters

NameTypeDescription
aURLconst stringAbsolute URL of the resource to delete on the server.

Return Value

Response body (often a JSON status document) decoded as a string. (string)

Remarks

DELETE requests typically carry no body. A successful call usually returns 204 No Content with an empty string, or 200 OK with a confirmation document depending on the server.

Example

vResponse := oClient.Delete('https://api.example.com/users/42');

Overload 2

Syntax

procedure Delete(Const aURL: string; const aResponseContent: TStream);

Parameters

NameTypeDescription
aURLconst stringAbsolute URL of the resource to delete on the server.
aResponseContentconst TStreamStream that collects the server's response body verbatim.

Remarks

Stream-based variant that captures the response into a caller-supplied TStream. Choose this overload when the deletion response may be large or needs to be persisted directly to disk.

Example

oOut := TMemoryStream.Create;
try
  oClient.Delete('https://api.example.com/users/42', oOut);
finally
  oOut.Free;
end;

Back to Methods