To provide this example, the basics of HTTP are first explained. This is important to understand the functionality of the interface.
The following points should be noted:
The structure of a URL looks like this:
http://server.tld/getdata?project=you%26i+project&id=25#anker
| Component | Meaning |
|---|---|
| http:// | Defines the protocol. Antcas Control currently supports http and https. |
| server.tld | Defines the domain (DNS) or IP address of the target server. |
| getdata | Is the URI of the server. This corresponds to the target page, comparable to a path. |
| ?[...] | The ? separates the URL from the so-called GET request, followed by all form data also called query. The query is always encoded to replace unsupported characters. |
| #[...] | The #-sign defines an anchor on a page. This allows jumping (scrolling) to any location. These data are not transmitted to the server. In addition, this area including # must not be copied into the query, as this would otherwise call another target page on the server. |
The configuration of the target servers is done in the corresponding HTTP gateway.
The structure of a query consists of a header and a body. The header always shows the method used, the URI, and the protocol in the first line.
GET /getdata?project=you%26i+project&id=25 HTTP/1.1
Host: server.tld
This is followed by the server's response. This includes the status code of the query. The body follows the header with an empty line.
HTTP/1.1 200 OK
Server: Apache2
Content-Type: text/html
<html>Hello World</html>
The status codes are divided into groups. The groups are defined by the first digit. In addition, after the number comes the meaning in plain text. Here are some examples:
| Status | Description |
|---|---|
| 200 OK | The request was successful. |
| 301 Found | Redirection to the actual page. Since Antcas Control follows links, this response is usually hidden. |
| 404 Not Found | The specified page was not found. |
| 500 Internal Server Error | A server error has occurred. |
The GET and POST methods are used most frequently.
| Method | Description |
|---|---|
| GET | The GET query is the standard query. This does not support any content. |
| POST | The POST query sends content to the server. The content can also be empty. The advantage here is that the content has no length restriction. With a GET request, only a certain number of data can be transmitted. |
| PUT | PUT is used by interfaces to exchange information. |
| DELETE | Together with PUT, it is used to delete data. |
| (others) | Other HTTP methods are also supported but require appropriate configuration. |
Most authentications take place in the header. However, there are also requests that are defined in the query or content.
It may be necessary to create a session before the actual request. The session is then set as a header Set-Cookie. This cookie must then be passed again. The contents of the cookies are case-sensitive, meaning the contents must be passed one-to-one. Here is a simplified example:
POST /login HTTP/1.1
Host: server.tld
username=myname&password=1234
Server response:
HTTP/1.1 200 OK
Server: Apache2
Content-Type: text/html
Set-Cookie: SESSION=vmvbquk7dq6dbbcq
Now the cookie can be used again in the next query:
GET /opendoor HTTP/1.1
Host: server.tld
Cookie: SESSION=vmvbquk7dq6dbbcq
In the browser's developer console, the request can be evaluated and tested under Network. In addition, it is sometimes advisable to copy or view the header.
In Antcas Control, an HTTP interface with a gateway is created. The gateway is configured as an HTTP client. Here, the target address and port (required) are entered accordingly. Then, in the structure, the query is configured. For this purpose, the URL is entered as a variable under Communication.
To create a simple query, any data type is selected. This is preferably a string. If a value change occurs at the output, a query is already executed. The value is then used directly as a query.
A more complex query is created using the function block HTTP_REQUEST. For this purpose, the data type of communication must be set to raw. The response can then be evaluated using the function block HTTP_RESPONSE. The ID of the query must be linked for this purpose in order to correctly assign the response to the request.
In this example, data is sent to a server using the GET method and the response is evaluated. The complete URL is as follows:
http://server.tld/getdata?project=you%26i+project&id=25
To retrieve or send data from/to a server, the following example is used:

Note: The example does not show how the request must be triggered. This is triggered with a positive edge at the input SET. To prevent an unwanted query, the input DIS should be set to TRUE.
The configuration of the interface is configured as follows:
