Back to Aurora Vision Library website

You are here: Start » Function Reference » System » HTTP » Http_SendRequest_GET

Http_SendRequest_GET


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Sends a GET request to server and receives a text answer.

Syntax

C++
C#
 
void avl::Http_SendRequest_GET
(
	const atl::String& inUrl,
	const atl::Array<atl::String>& inHeaders,
	const atl::Array<atl::String>& inHeadersData,
	const atl::Array<atl::String>& inFields,
	const atl::Array<atl::String>& inFieldsData,
	int inTimeout,
	bool inAllowUntrusted,
	const atl::Optional<atl::File>& inCaCertFile,
	atl::Conditional<atl::String>& outAnswer,
	int& outResponseCode
)

Parameters

Name Type Range Default Description
Input value inUrl const String& URL of request. Without parameters.
Input value inHeaders const Array<String>& Request headers to send. They will be automatically encoded.
Input value inHeadersData const Array<String>& Request headers to send. They will be automatically encoded.
Input value inFields const Array<String>& Request data to send. It will be automatically encoded.
Input value inFieldsData const Array<String>& Request data to send. It will be automatically encoded.
Input value inTimeout int 0 - 60 Request timeout in seconds.
Input value inAllowUntrusted bool False Whether or not to allow untrusted SSL certificates.
Input value inCaCertFile const Optional<File>& NIL File holding one or more certificates to verify the peer with.
Output value outAnswer Conditional<String>& Answer text if provided in UTF-8 encoding.
Output value outResponseCode int& Answer code. Typically 200 for OK.

Description

Filter sends a GET request to the server. Filter waits for the server text answer.

When inCaCertFile is set to Auto, certificates installed in the operating system are used, otherwise only certificates from the input file are used.

Examples

Filter executed with parameters:

  • inUrl = http://localhost/test
  • inFields = ["param1", "param2"]
  • inFieldsData = ["1", "2"]

Request sent to the server:

GET /test?param1=1&param2=2 HTTP/1.1
Host: localhost
User-Agent: Aurora Vision/1.0
Accept: */*

It is also possible to include custom headers in the request. For this purpose, inHeaders and inHeadersData parameters are used.

Using the following values for these parameters:

  • inHeaders = ["Header1", "Header2"]
  • inHeadersData = ["value1", "value2"]

causes the following headers to be added to the request:

Header1: value1
Header2: value2

Remarks

Filter only accepts text answers encoded using UTF-8 or plain ASCII. To receive answer in arbitrary format please use Http_SendRequest_GET_ByteBuffer.

Errors

List of possible exceptions:

Error type Description
DomainError Different size of inFields and inFieldsData in Http_SendRequest_GET.
DomainError Different size of inHeaders and inHeadersData in Http_SendRequest_GET.
DomainError Empty inUrl in Http_SendRequest_GET.
DomainError Invalid inUrl in Http_SendRequest_GET.

See Also