CallRESTEndpoint

The CallRESTEndpoint is a function that allows you to call REST web services. Simply drag it onto the design canvas and configure the properties required by the service that you want to call.

Properties

Authentication

The authentication properties are needed when authentication is required by the web service being called.

Type

The type of authentication required by the server of the web service that is being called.

Options:

  • Anonymous

  • Basic

  • Digest

  • Windows

The Type you select will determine which authentication properties will be available to complete. 'Anonymous' will require no additional properties.

Basic

The following properties are available when the Type is 'Basic'.

Username

The username to authenticate against.

Password

The password to authenticate against.


Digest

The following properties are available when the Type is 'Digest'.

Username

The username to authenticate against.

Password

The password to authenticate against.

Domain

The domain to authenticate the user against.


Windows

The following properties are available when the Type is 'Windows'.

Use default credentials

When this field is checked, the credentials of the currently logged in Windows user will be used.

When this field is not checked, the Domain, Username and Password properties will display to specify custom Windows credentials.

Note: Successful Windows authentication requires a Windows user and security for the site defined in Internet Information Server (IIS).


Request

URL

The base URL to use for the service request. This excludes any parameter-specific information that are send with the request. A valid example for this field could look like this:

http://localhost:8022/Service/ExecuteService

Method

HTTP Method type to use for the request.

Options: learn more

  • GET

  • POST

  • PUT

  • DELETE

  • HEAD

  • PATCH

  • OPTIONS

Query string

A list of parameters to use in order to build up the query string. A query string with a format similar to the following will be generated (note that parameters have not been URL encoded to improve readability):

origin=CapeTown&destination=Johannesburg&sensor=false&alternatives=true

Headers

Arguments and data are commonly transferred using the headers of a call. You can add data to the headers if the web service requires this.

Body format

The Body of a request needs to be in the format that the web service understands.

Options:

  • Text

  • Xml

  • Json

  • Stream

  • URL encoded content

  • Multipart encoded content

Text, Xml, Json

The following properties are available when the Body format is 'Text', 'Xml' or 'Json'.

Body

The payload of your web service call in the format specified by the [Body format](#properties-bodyFormat) property. If you pass data in the body, you cannot use the GET [method](#properties-method), but need to use POST instead.


Stream

The following properties are available when the Body format is 'Stream'.

Stream from file

The file path whose contents will be sent in the body of the request.

File path

The file path whose contents will be sent in the body of the request.


Url encoded content

The following properties are available when the Body format is 'Url encoded content'.

Url encoded body

The URL encoded set of parameters to send in the body of the request.


Multi-part encoded content

The following properties are available when the Body format is 'Multi-part encoded content'.

Multi-part encoded body

The multi-part form data to send in the body of the request.

Click ... to add the multi-part form data in the editor.


When using a Binary file:
  • binary content is accepted (see the Value field in the 'myfile' example above)
  • the File Name must be specified
When using a Base64 file:
  • a string value is accepted (see the Value field in the 'somedata' example above)
  • the File Name must not be specified


If you are not sure which Body format to use, the standard and most likely value is 'Text'. The service that you are calling should have API documentation that will give an indication of the required format. If no API documentation exists, then the developers of the service should be able to assist in identifying the correct value.


Request Signing (Certificate)

Sign with certificate

Specifies whether the client should expose a certificate with which to sign requests.

Certificate

The following properties are required when Sign with certificate is selected.

Certificate path

The certificate to use to sign requests.

Certificate password

The certificate password.


Request Signing (Certificate)

Sign request

Specifies whether the request should be signed using the OAuth authentication standard.

Encryption key

Only available when Sign request is selected.

The key used to encrypt the request when signing.


Response

This section allows you to configure the structure of the data that is being returned from the web service.

The supported return formats are JSON, XML, or a plain string.

Output type

The data type of the response.

The List option indicates whether the response should be interpreted as a list of values. The List option requires you to use JSON or XML for the Body format.

If you create a Type and you have formatted your response accordingly, you can point the Output type field at your user defined type. After the service has executed, Linx will map the return result to the specified structure. Any field that is specified in the return structure that is not present in the response will be ignored.

List data type

This option is only visible if the Output type is set to 'List'. To access this property, click on the data type editor icon, displayed next to the 'List' option (after you selected it).

Indicates the data type for the items in the list.


Settings

Handle all status codes

Check this property to handle success and error responses.

When checked, it will display 2 execution paths in the design canvas – “Success” and “Error”.

Status codes

Successful requests (response status code 200-299) will go into the “Success” execution path, while all other responses will go into the “Error” execution path.

Note:

Invalid requests, e.g. trying to connect to an invalid address will still throw an exception (and not go into the “Error” execution path).

The “Error” execution path is only there to handle invalid responses.

Allow untrusted certificates

Select 'True' to allow connections to sites that make use of untrusted (e.g. self-signed) certificates.

Timeout

The timeout value for the web service call.

Max response content size

The maximum amount of bytes response content can contain.


Web proxy

These settings are applicable only if you or the server you're contacting are using a proxy server.

Proxy name

The IP address or URL of your proxy server.

Port

The web service call is commonly performed over port 80, but you can change that if you have configured the service or proxy to use a different port.

Bypass on local

While you are developing the function you may have a different setup from the live environment. When this property is checked, the proxy setup is ignored for your local machine.


Wikipedia: Representation state transfer (REST)

Code Project: Everything About REST Web Services - What and How

IBM developerWorks: RESTful Web services - The basics

Consuming REST APIs

Tutorial: Consuming REST APIs