Frends.Web
Warning: Legacy tasks, see readme. The public github repository of the FRENDS Task for Web and HTTP related adapters. The tasks currently support REST API calls with various authentication methods as well as XML and plain requests over HTTP(S).
Install / Use
/learn @FrendsPlatform/Frends.WebREADME
[!WARNING] Legacy tasks — do not use in new projects. The tasks in this repository are part of Frends legacy task library. For current, supported tasks visit tasks.frends.com.
Frends.Web
FRENDS Tasks for HTTP REST requests.
Installing
You can install the task via FRENDS UI Task view, by searching for packages. You can also download the latest NuGet package from https://www.myget.org/feed/frends/package/nuget/Frends.Web and import it manually via the Task view.
Tasks
RestRequest
The Web.RestRequest task is meant for simple JSON REST requests. It only accepts a JSON response, and always add the Accept : application/json header. If you need more options, please use the HttpRequest task.
If the response is not valid JSON, the task will throw an JsonReaderException with the following message: "Unable to read response message as json: {response}". The task will still accept a response with an empty bodu, though, and return an empty string in that case.
Input:
| Property | Type | Description | Example |
|-------------------|-------------------------------------------------------------|---------------------------------------------------------|-------------------------------------------|
| Method | Enum(GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, CONNECT) | Http method of request. | POST |
| Url | string | The URL with protocol and path to call. | https://foo.example.org/path/to https://foo.example.org/path/to?Id=14 |
| Message | string | The message to be sent with the request. Not used for Get requests | {"Name" : "Adam", "Age":42} |
| Headers | Array{Name: string, Value: string} | List of HTTP headers to be added to the request. Setting charset parameter encodes message. | Name = Content-Type, Value = application/json |
Options:
| Property | Type | Description |
|----------------------------------|------------------------------------|---------------------------------------------------------------------|
| Authentication | Enum(None, Basic, Windows,WindowsIntegratedSecurity, OAuth, ClientCertificate ) | Different options for authentication for the HTTP request. |
| Connection Timeout Seconds | int | Timeout in seconds to be used for the connection and operation. Default is 30 seconds. |
| Follow Redirects | bool | If FollowRedirects is set to false, all responses with an HTTP status code from 300 to 399 is returned to the application. Default is true.|
| Allow Invalid Certificate | bool | Do not throw an exception on certificate error. Setting this to true is discouraged in production. |
| Throw Exception On ErrorResponse | bool | Throw a WebException if return code of request is not successful. |
| Allow Invalid Response Content Type Char Set | bool | Some Api's return faulty content-type charset header. If set to true this overrides the returned charset. |
| Username | string | This field is available for Basic- and Windows Authentication. If Windows Authentication is selected Username needs to be of format domain\username. Basic authentication will add a base64 encoded Authorization header consisting of Username and password fields. |
| Password | string | This field is available for Basic- and Windows Authentication. |
| Token | string | Token to be used in an OAuth request. The token will be added as a Authentication header. Authorization Bearer '{Token}' |
| Certificate Source | Enum(None, CertificateStore, File, String) | Where the certificate is loaded from. If None is selected and a Certificate Thumbprint has been provided, the certificate store will be used for backwards compatibility |
| Certificate Thumbprint | string | This field is used with Client Certificate Authentication. The certificate needs to be found in Cert\CurrentUser\My store on the agent running the process. |
| Load Entire Chain For Certificate | bool | Should the entire certificate chain be loaded and included in the request |
| Client Certificate File Path | string | Path to the file containing the client certificate, all certificates in the file are loaded. Pfx (pkcs12) recommended, see X509Certificate2Collection for supported formats. |
| Client Certificate Key Phrase | string | Key phrase for loading the certificate from a file or base64 string |
| Client Certificate In Base64 | string | Client certificate contents in base64 |
| Automatic Cookie Handling | bool | If set to false, cookies must be handled manually through Cookie -header. Defaults to true. |
Result:
| Property | Type | Description | |-------------------|---------------------------|----------------------| | Body | JToken | Response body | | Headers | Dictionary<string,string> | Response headers | | Status Code | int | Response status code |
HttpRequest
HttpRequest is a generic HTTP request task. It accepts any type of string response, e.g. application/xml or text/plain
Input:
| Property | Type | Description | Example |
|-------------------|-------------------------------------------------------------|------------------------------------------------------------------------|-------------------------------------------|
| Message | string | The message to be sent with the request. Not used for Get requests | {"Name" : "Adam", "Age":42} |
| Method | Enum(GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, CONNECT) | Http method of request. | POST |
| Url | string | The URL with protocol and path to call | https://foo.example.org/path/to?Id=14 |
| Headers | Array{Name: string, Value: string} | List of HTTP headers to be added to the request. | Name = Content-Type, Value = application/json |
Options:
| Property | Type | Description |
|----------------------------------|------------------------------------|---------------------------------------------------------------------|
| Authentication | Enum(None, Basic, Windows,WindowsIntegratedSecurity, OAuth, ClientCertificate) | Options for authentication for the HTTP request. |
| Connection Timeout Seconds | int | Timeout in seconds to be used for the connection and operation. Default is 30 seconds. |
| Follow Redirects | bool | If FollowRedirects is set to false, all responses with an HTTP status code from 300 to 399 is returned to the application. Default is true.|
| Allow Invalid Certificate | bool | Do not throw an exception on certificate error. Setting this to true is discouraged in production. |
| Throw Exception On ErrorResponse | bool | Throw a WebException if return code of request is not successful. |
| Allow Invalid Response Content Type Char Set | bool | Some Api's return faulty content-type charset header. If set to true this overrides the returned charset. |
| Username | string | This field is available for Basic- and Windows Authentication. If Windows Authentication is selected Username needs to be of format domain\username. Basic authentication will add a base64 encoded Authorization header consisting of Username and password fields. |
| Password | string | This field is available for Basic- and Windows Authentication. |
| Token | string | Token to be used in an OAuth request. The token will be added as a Authentication header. Authorization Bearer '{Token}' |
| Certificate Source | Enum(None, CertificateStore, File, String) | Where the certificate is loaded from. If None is selected and a Certificate Thumbprint has been provided, the certificate store will be used for backwards compatibility |
| Certificate Thumbprint | string | This field is used with Client Certificate Authentication. The certificate needs to be found in Cert\CurrentUser\My store on the agent running the process. |
| Load Entire Chain For Certificate | bool | Should the entire certificate chain be loaded and included in the req
