# Panel (pick_item_rest)

Pick one or more values from rest call and store them into output variable

# Screenshots

pick_item_rest

# Config

pick_item_rest:

	config:

		# Request
		#
		### Note
		### Variable "$___query" is available in every option under request. It represents user search input. It must be used with {syntax off} macro. For example: url: "{syntax off}http://www.goo.gl/?s={$___query}"
		request:

			# Optional | Type: string | Default: GET
			# HTTP method
			method: "GET"

			# Required | Type: string | Default: null
			# Requested URL
			url: "http://www.goo.gl/?s={$__user->fullname}"

			# Optional | Type: array | Default: []
			# Sent headers
			headers: [foo: "bar"]

			# Auth
			auth:

				# Basic Auth
				basic:

					# Required | Type: string | Default: null
					# Username
					name: "john"

					# Required | Type: string | Default: null
					# Password
					password: "doe"

			# Body
			body:

				# Required | Type: string | Default: RAW
				# Defines how to encode data
				#
				### Note
				### e.g. JSON will encode given request.body.data into JSON string
				type: "RAW"

				# Optional | Type: mixed | Default: null
				# Data to be sent as request body
				#
				### Note
				### Panel works only with string data, any other data must be encoded with option type: JSON
				#
				### Examples
				### - 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?'
				### - Data contains simple data structures. Type option must be JSON. Data will be encoded into json string
				data: "{output(["name" => $username])]"

			# Optional | Type: bool | Default: true
			# Whether SSL configuration should be verified
			#
			### Note
			### Do not turn off, if it's not really necessary. It should be always preferred to discuss that problem with server administrator and update certificates.
			ssl_verify: true

		# Response
		response:

			# Optional | Type: string | Default: AUTO
			# Defines how to treat the response data
			#
			### Note
			### e.g. JSON will expect the response body to be json string and automatically decodes it into
			### multidimensional array. The array is then provided as in input option.
			type: "AUTO"

		# Required | Type: string | Default: null
		# Lattenizer expression that transforms api call response to array of items used in selectbox and output variable
		#
		### Note
		### Local variable ___response is available to access data received from api call defined in request option. It is required to return array of objects. Object has "id" and "label" required properties. Object also has "data" optional property. All three properties are saved in output variable.
		input: "{syntax off}{foreach $___response["data"]["body"] as $restItem}{* build item *}{/foreach}{output($data)}"

		# Required | Type: string | Default: null
		# Json variable to store picked values
		output: null

		# Optional | Type: bool | Default: false
		# Allow to store single or multiple items
		multiple: true

		# Optional | Type: int | Default: 3
		# Min input filter length for start autocompletion
		minLength: 3

		# UI
		ui:

			# Optional | Type: string | Default: null
			# Default message for selectbox
			placeholder: "Start typing..."

			# Optional | Type: string | Default: null
			# Panel title
			title: "Panel title"

			# Optional | Type: string | Default: null
			# Panel description
			description: "Panel description"
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108