# rest

Name rest
Type panel
Version 1.0
Since 2020-01-01

# Prologue

Panel for sending request over HTTP. Responses can be saved into variable if response variable is configured.

# Preview

# Configuration

rest:
	render: {width: 6}
	config:

		# Required
		# Defines HTTP request
		request:

			# Optional
			# default value GET (possible values GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH)
			method: POST

			# Required
			# Full lattenizer support
			url: 'http://www.goo.gl/?s={$__user->fullname}'

			# Optional
			# default empty array
			headers: ["foo" = "bar"]

			# Optional
			auth:

				# Optional
				basic:

					# Required when auth.basic key is present
					# Default value ""
					name: use

					# Required when auth.basic key is present
					# Default value ""
					password: pass

			# Optional
			body:

				# Optional - default RAW
				# Possible values: RAW, JSON (XML, BINARY etc. to be added)
				# Defines how to encode data.
				#
				# Example: JSON will encode given request.body.data into JSON string
				type: JSON

				# Optional - default null
				# Data to be sent over HTTP
				# Before showing data in textarea in panel. Data is lattenized and encoded to selected type.
                # Panel can only work with string data. If any other data is supplied,
                # it must be encoded to JSON string (option type: JSON)
				#
				# Example 1:
				# Data is string and type options is RAW. This data will not be encoded. It can be any string
                # data: 'Hello, {$name}, how are you doing?'
				#
				# Example 2:
				# Data contains simple data structures. Type option must be JSON. Data will be encoded into json string
				data:
					name: '{$name}'
                    age: '{$age}'
                    friends:
                        count: '{$friendCount}'

		# Optional
		# Describes how to treat response (conversion and storing)
		response:

			# Optional - default AUTO
				# Possible values: AUTO, RAW, JSON (XML, BINARY etc. to be added)
			# Defines how to treat the response data in order to save to variable
			#
			# Example: JSON will expect the response body to be json string and automatically decodes it into
			#          multidimensional array and this array is then saved into process variable
			type: JSON

			# Optional - default NULL
			# Process variable name where the http request response should be stored
			# Must be a JSON variable type
			# Fields of variable: 'code', 'headers', 'body', 'error', 'error_message'
			variable: callResult

		ui:
			# Optional | Default - null
			# Panel title
			title: Some panel name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84