Skip to content

Http.Send

method · Http · cAlgo.API

DesktopCLICloud

Performs a request to the specified URI. The request method depends on the value of the request.Method property.

Environment behaviour

Cloud — not supported. No request is sent. The response, or the callback, has IsSuccessful false, StatusCode 403 and Body null. No exception is thrown.

Definition

HttpResponse Send(HttpRequest request)
api.Http.Send(request: HttpRequest) -> HttpResponse

Parameters

Name C# type Python type Description
request HttpRequest HttpRequest The HttpRequest object representing the request contents.

Returns HttpResponse — The HttpResponse object representing the result of the request.

Examples

var request = new HttpRequest(new Uri("https://api.example.com/signals"))
{
    Method = HttpMethod.Post,
    Body = "EURUSD buy"
};
var response = Http.Send(request);
Print("Status code: {0}", response.StatusCode);
from System import Uri

request = HttpRequest(Uri("https://api.example.com/signals"))
request.Method = HttpMethod.Post
request.Body = "EURUSD buy"
response = api.Http.Send(request)
api.Print(f"Status code: {response.StatusCode}")

See also