Wiki source code of HTTP-Request


Show last authors
1 {{figure image="post_request_en.png" clear="h1"}}
2 Interface for setting parameters of actions of type //HTTP request//.
3 {{/figure}}
4
5 Actions of type //HTTP request// allow you to perform arbitrary HTTP requests to an URL. You can also transmit the submitted form data as well as files. As such, this action provides a universal interface to other web services.
6
7 == Parameters ==
8
9 === HTTP request details ===
10
11 ; HTTP method
12 : The method to be used for the HTTP request. By default //POST// is used. Aside from the standard methods such as //GET//, //DELETTE//, or //POST//, you can also enter a custom method when the web service requires it. Note that some methods such as //GET// do not support an HTTP body. For these methods, parameters are added to the URL as URL parameters and files are omitted.
13 ; Request URL
14 : The address to which the HTTP request should be sent.
15 ; XSL template
16 : In most cases, the external service to which the HTTP request was transmitted will return a response in the form of XML or HTML. In some cases, it may be necessary for these to be displayed or further processed in other actions. By selecting an XSL template you have the possibility to prepare the returned response or format it differently.
17 ; Request encoding
18 : Select the encodng to use for sending the HTTP request (when sending plain text content).
19 ; Response encoding
20 : Select the encoding to use for interpreting the HTTP response (when receiving plain text content).
21 ; Return as response page
22 : Deliver the response of the action to the client. If this option is disabled, the default FORMCYCLE response will be delivered.
23
24 {{figure image="post_request_extended_en.png" clear="h1"}}
25 Extended interface for setting parameters of actions of type //HTTP request//.
26 {{/figure}}
27
28 === Request type ===
29
30 The request type determines the content of the HTTP body. You can select between the following:
31
32 ; Custom
33 : Uses the entered plain text content as the HTTP body.
34 ; Automatically according to content
35 : For backwards compatibility: uses //x-www-form-urlencoded// when no files exist and //x-www-form-urlencoded// when at least one file was selected and that file exists when the workflow action is executed.
36 ; Contents of a file
37 : Uses the binary content of the selected file as the HTTP body.
38 ; Form data without files (form-urlencoded)
39 : Sends a request body with a plain text URL encoded string containing the data (//x-www-form-urlencoded//). This request type does not support files.
40 ; Form data including files (multipart)
41 : Sends a multipart body (MIME type //multipart/form-data//), which supports sending files.
42 ; URL with parameters
43 : Do not send any body, add all data as URL parameters to the request URL. Files cannot be sent with this request type.
44
45 === Additional parameters ===
46
47 ; Additional headers
48 : A list of headers can be stored here, which will be transmitted in any case.
49 ; Transfer all form values
50 : Is the possibility to transfer all data collected from the form. The name of the form element or [[Alias>>Formcycle.Designer.Form.ElementProperties.BaseProperties]] is here the field identifier within the HTTP request. The value is the input from the form.
51 [[image:POST_Bezeichner.PNG]]
52 ; Use aliases (for form elements and uploads).
53 : Form fields are submitted with their form field aliases instead of form field names.
54 ; Additional parameters
55 : A list of parameters can be stored here, which will be transferred in any case. Often additional static information is stored here, which is required by the external service, or if field identifiers are expected to be different from those stored in the form.
56
57 === Add files to the request (multipart request) ===
58
59 ; Files
60 : Selection of files that can be added to the request. See [[actions>>doc:Formcycle.Designer.Workflow.Actions.WebHome]] for a list of supported URL protocols.
61
62 === Advanced connection settings ===
63
64 ; No error on 4xx responses
65 : By default, the error //CLIENT_ERROR// is thrown when the HTTP response contains a 4xx status code. The content of the response is then accessible via an ERROR variable. When this option is enabled, no error is throws and the response content is available via a RESULT variable.
66 ; No error on 5xx responses
67 : By default, the error //SERVER_ERROR// is thrown when the HTTP response contains a 4xx status code. The content of the response is then accessible via an ERROR variable. When this option is enabled, no error is throws and the response content is available via a RESULT variable.
68
69 **HTTP Basic Authentication**
70
71 ; Use HTTP Basic Authentication
72 : //Name//: Username for the URL
73 : //Password//: Password for the user
74
75 **Use proxy server**
76
77 ; Forwarding to a proxy server
78 : //proxy-server hostname//: Name of the proxy server
79 : //Port//: Port of the proxy server. Default is {{code language="none"}}80{{/code}}.
80 ; Proxy authentication: Authentication to the proxy server.
81 : //Login//: Username for the proxy server
82 : //password//: Password for the proxy user
83
84 === Filing the created files ===
85
86 ; Attach file to form record
87 : If this option is selected, files created in this action will be attached to the form record. Otherwise, they are only available for other actions within the workflow processing in the same processing chain.
88
89 == Action variables ==
90
91 Actions of type //HTTP request// provide [[Action variables>>Formcycle.UserInterface.Variables||anchor="HActionvariables"]] which can be used in subsequent actions.
92
93 === Standard action variables ===
94
95 ; [%$<action name>.SUCCESS%]
96 : Return whether action was successfully executed. Returns Boolean (true/false).
97 ; [%$<action name>.RESULT%]
98 : Return all results provided by the action in structured form.
99
100 ; [%$<action name>.ERROR_CODE%]
101 : The error code thrown in case of an error in the action. Empty if no error occurred.
102 ; [%$<action name>.ERROR_MESSAGE%]
103 : The thrown error message in the action's error case. Empty if no error occurred.
104
105 === Action specific action variables ===
106
107 ; [%$<action name>.RESULT.redirectUrl%]
108 : Contains the URL to the destination in case of a redirect.
109 ; [%$<actionName>.RESULT.redirected%]
110 : Returns true if the HTTP word results in a redirect, false otherwise.
111 ; [%$<actionName>.RESULT.responseBody%]
112 : Contains the response returned by the HTTP request that was triggered. In the case of a redirect, this value is empty.
113 ; [%$<actionName>.RESULT.responseCode%]
114 : Contains the returned HTTP status code.
115 ; [%$<actionName>.RESULT.responseJson%]
116 : Contains a JSON object or JSON array if the HTTP response is not a redirect and the content-type of the returned content is application/json
117 ; [%$<actionName>.RESULT.responseReasonPhrase%]
118 : In case of a successful HTTP request, contains the status message, such as "OK" or "Found".
119 ; [%$<ActionName>.RESULT.responseStatusLine%]
120 : In case of a successful HTTP request, contains the status message, such as "OK" or "Found".
121 ; [%$<action name>.ERROR.redirectUrl%]
122 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: Contains the URL to the destination in case of a redirect.
123 ; [%$<actionName>.ERROR.redirected%]
124 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: Returns true if the HTTP word results in a redirect, false otherwise.
125 ; [%$<actionName>.ERROR.responseBody%]
126 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: Contains the response returned by the HTTP request that was triggered. In the case of a redirect, this value is empty.
127 ; [%$<actionName>.ERROR.responseCode%]
128 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: Contains the returned HTTP status code.
129 ; [%$<actionName>.ERROR.responseJson%]
130 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: Contains a JSON object or JSON array if the HTTP response is not a redirect and the content-type of the returned content is application/json
131 ; [%$<actionName>.ERROR.responseReasonPhrase%]
132 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: In case of a successful HTTP request, contains the status message, such as "OK" or "Found".
133 ; [%$<ActionName>.ERROR.responseStatusLine%]
134 : In case the error code was //CLIENT_ERROR// or //SERVER_ERROR//: In case of a successful HTTP request, contains the status message, such as "OK" or "Found".
135 ; [%$<actionName>.ERROR.message%]
136 : Error message returned if the specified external URL resource does not match a valid format, the attached server cannot be reached or does not return a response, errors occurred while adding files to the HTTP request, or the configured XSLT transformation failed.