On the basis of the example provided, this page describes how use the URL adapter with the HTTP protocol.
Static GET Request
The following example shows how to access a web resource through the URL adapter.
The request operation uses the alias to identify the web resource and the method to perform. The response is a Blob. In this implementation, the response contents are mapped to a form to be displayed to the user.
In this example, the web resource is also part of the same example service (see API.HelloAPI). The URL of the resource is specified in the URL alias as follows:
Adapter Attribute | Value |
---|
protocol | http |
port | 11112 |
path | hello/hello/GETHelloStatic |
host | localhost |
method | GET |
Find below a list of all attributes that can be used with the HTTP protocol.
Full Dynamic GET
Sometimes URL parameters are not static but must be calculated or are know at runtime only. To reflect this, you can provide all information from the URL adapter alias dynamically on the request operation.
Tip |
---|
You can also use a mixture of static and dynamic access. Specify the static parts on the alias and provide the dynamic parts via the URL adapter parameters. This can be helpful because the settings of the alias can be changed in the service configuration later. |
The following example shows a full dynamic request. All needed information to access the web resource is specified via the parameters.
Action composeURL builds the URL to access the dynamic resource of the API and the name given by the user is added.
Alias Attributes
Find below a list of relevant alias attributes, if the URL adapter is used with the HTTP protocol. Default values used when an option is not explicitly set are written in bold.
Multiexcerpt |
---|
MultiExcerptName | http_alias_attributes |
---|
|
Attribute | Description | Allowed Values / Examples |
---|
Standard |
---|
protocol | Multiexcerpt include |
---|
MultiExcerptName | protocol |
---|
PageWithExcerpt | URL |
---|
|
| one of: http (default), https | port | Multiexcerpt include |
---|
MultiExcerptName | port |
---|
PageWithExcerpt | URL |
---|
|
| a valid port number (default: 80) | path | Multiexcerpt include |
---|
MultiExcerptName | path |
---|
PageWithExcerpt | URL |
---|
|
|
| method | Multiexcerpt include |
---|
MultiExcerptName | method |
---|
PageWithExcerpt | URL |
---|
|
| one of: get (default), post, put, delete, patch, head, options
| Advanced |
---|
user | Username/password. |
| followRedirects | Multiexcerpt include |
---|
MultiExcerptName | followRedirects |
---|
PageWithExcerpt | URL |
---|
|
| any positive integer or 0 | options | Multiexcerpt include |
---|
MultiExcerptName | options |
---|
PageWithExcerpt | URL |
---|
|
| valid cURL options, e.g. CURLOPT_TIMEOUT=20 | Proxy |
---|
proxyURL | Multiexcerpt include |
---|
MultiExcerptName | proxyURL |
---|
PageWithExcerpt | URL |
---|
|
|
| proxyUser | Multiexcerpt include |
---|
MultiExcerptName | proxyUser |
---|
PageWithExcerpt | URL |
---|
|
|
| proxyType | Multiexcerpt include |
---|
MultiExcerptName | proxyType |
---|
PageWithExcerpt | URL |
---|
|
| one of: HTTP , SOCKS5 | SSL |
---|
sslCAInfo | Multiexcerpt include |
---|
MultiExcerptName | sslCAInfo |
---|
PageWithExcerpt | URL |
---|
|
|
| sslCertificateFile | Multiexcerpt include |
---|
MultiExcerptName | sslCertificateFile |
---|
PageWithExcerpt | URL |
---|
|
|
| sslPrivateKeyFile | Multiexcerpt include |
---|
MultiExcerptName | sslPrivateKeyFile |
---|
PageWithExcerpt | URL |
---|
|
|
| sslPrivateKeyPassword | Multiexcerpt include |
---|
MultiExcerptName | sslPrivateKeyPassword |
---|
PageWithExcerpt | URL |
---|
|
|
| sslCertificateType | Multiexcerpt include |
---|
MultiExcerptName | sslCertificateType |
---|
PageWithExcerpt | URL |
---|
|
| one of: PEM (default), DER | sslVerifyHost | Multiexcerpt include |
---|
MultiExcerptName | sslVerifyHost |
---|
PageWithExcerpt | URL |
---|
|
| On | Verification on. | Off | Verification off (default). | Existence | Limit verification to the mere existence of the host. | sslVerifyPeer | Multiexcerpt include |
---|
MultiExcerptName | sslVerifyPeer |
---|
PageWithExcerpt | URL |
---|
|
| On | Verification on (default). | Off | Verification off. | sslPrivateKeyType | Multiexcerpt include |
---|
MultiExcerptName | sslPrivateKeyType |
---|
PageWithExcerpt | URL |
---|
|
| one of: PEM (default), DER | |
URL Adapter Response
The adapter returns the following parameters:
Multiexcerpt include |
---|
MultiExcerptName | url_adapter_outgoing |
---|
PageWithExcerpt | URL |
---|
|
Multiexcerpt include |
---|
SpaceWithExcerpt | INTERNAL |
---|
MultiExcerptName | url_adapter_http_headers |
---|
PageWithExcerpt | INTERNAL:_designer_excerpts |
---|
|