Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function uses the GET method to retrieve content from an HTTP server, see Response(3.0).

Code Block
stringResponse httpGet
    ( string host,
      string path,
      string protocol,			    //Optional
      int port,                     //Optional
      boolean secure,               //Optional
      int requestTimeout,           //Optional
      int connectionTimeout,        //Optional
      string username,              //Optional
      string password,              //Optional
      map<string, string> headers ) //Optional

...

ParameterDescription

host

The name or IP address of the HTTP server. 

path

The path.

Info
titleExample - path


Code Block
/api/v2/doc



protocolThe protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2".
port

The port number to contact the HTTP server on. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default.

secureIndicates whether the data should be sent in secure mode or not.

requestTimeout

The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds.

connectionTimeout

The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds.

username

A username for an account on the HTTP server.

password

Password associated with the username.

headers

Custom HTTP request headers.

Returns

Content from A response from the HTTP server. It will be be null if any part of the communication fails.

...

This function uses the POST method to send content to an HTTP/2 server and receives the response.

Code Block
stringResponse httpPost
    ( string host, 
      string path,		
      bytearray content, 
      string contentType,
      string protocol,			    //Optional
      int port,                     //Optional 
 	  boolean secure,               //Optional 
      int requestTimeout,           //Optional
      int connectionTimeout,        //Optional 
      string username,              //Optional
      string password,              //Optional
      map<string, string> headers ) //Optional

...

ParameterDescription

host

The name or IP address of the HTTP server. 

path

The path

Info
titleExample - path


Code Block
/api/v2/doc



bytearraycontent

The body of the request in bytearray format.

contentType

The MIME type of the content.

Info
titleExample - contentType


Code Block
application/json



protocol

The protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2".

port

The port number to contact the HTTP server on. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default.

secureIndicates whether the data should be sent in secure mode or not.

requestTimeout

The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds.

connectionTimeout

The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds.

username

A username for an account on the HTTP server.

password

Password associated with the username.

headers Custom HTTP request headers.

Returns

Content from A response from the HTTP server. It will be be null if any part of the communication fails.

...

This function makes an HTTP request and uses the specified method, e g GET, POST, PUT etc.

Code Block
stringResponse httpRequest
    ( string method,	
	  string host,	
      string path,
      bytearray content,
      string contentType, 
	  string protocol,			    //Optional
	  int port,					    //Optional
	  boolean secure,			    //Optional
      int requestTimeout,		    //Optional
	  int connectionTimeout,	    //Optional
	  string username,			    //Optional
	  string password, 			    //Optional
      map<string,string> headers )	//Optional

...

ParameterDescription

method

The HTTP method.

host

The name or IP address of the HTTP server. 

path

The path

Info
titleExample - path


Code Block
/api/v2/doc



content

The body of the request in bytearray format.

contentType

The MIME type of the content.

Info
titleExample - contentType


Code Block
application/json



protocolThe protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2".

port

The port number to contact the HTTP server on. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default.

secureIndicates whether the data should be sent in secure mode or not.

requestTimeout

The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds.
connectionTimeout The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds.

username

A username for an account on the HTTP server.

password

Password associated with the username.

headers Custom HTTP request headers.

Returns

A response from the HTTP server. It will be null if any part of the communication fails.

...

This function uses the POST method to send multipart binary contents to an HTTP server and receives the response.

Code Block
bytearrayResponse httpMultipartPost
    ( string host,
	  string path,
	  list<MultipartSegmentUDR> content,
	  string protocol,			    //Optional
   	  int port, 				    //Optional 
	  boolean secure,			    //Optional
      int requestTimeout,		    //Optional
	  int connectionTimeout,	    //Optional
      string username,              //Optional
      string password,              //Optional
      map<string, string> headers ) //Optional

...

ParameterDescription

host

The name or IP address of the HTTP server. 

path

The path on the server to which we should do the POST.

contentThe body of the the request.
protocolThe protocol used: HTTP/1 or HTTP/2. The default value is HTTP/1. To use HTTP/2, you must set this value to "h2".
port

The port to be used for the HTTP server. Port 80 is used for HTTP connection and 443 is used for HTTPS connection by default.

secureIndicates whether the data should be sent in secure mode or not.
requestTimeout The number of milliseconds to wait for a response. If the value is not specifically specified, the default timeout is used. The default value is 15000 milliseconds.
connectionTimeout The number of milliseconds to wait for a connection to be established. If the value is not specifically specified, the default timeout is used. The default value is 3000 milliseconds.
username Username for the account to be used on the HTTP server.
password Password associated with the username.
headers Custom HTTP request headers.

Returns

A bytearray from response from the HTTP server. It will be null if any part of the communication fails.

...

A truststore is a keystore that is used when deciding what to trust - truststore stores certificates from third parties. If you receive data from an entity that you already trust, and if you can verify that the entity is what it claims to be, you can assume that the data does in fact come from that entity.

By Default, Image Added uses its own truststore, which always trusts any server connection.

...