You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ Note that the `*_path` elements are for very specific use cases where one might
53
53
54
54
## `restapi` datasource configuration
55
55
-`path` (string, required): The API path on top of the base URL set in the provider that represents objects of this type on the API server.
56
+
-`query_string` (string, optional): An optional query string to send when performing the search.
56
57
-`search_key` (string, required): When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'.
57
58
-`search_value` (string, required): The value of 'search_key' will be compared to this value to determine if the correct object was found. Example: if 'search_key' is 'name' and 'search_value' is 'foo', the record in the array returned by the API with name=foo will be used.
58
59
-`results_key` (string, required): When issuing a GET to the path, this JSON key is used to locate the results array. The format is 'field/field/field'. Example: 'results/values'. If omitted, it is assumed the results coming back are already an array and are to be used exactly as-is
Description: "The API path on top of the base URL set in the provider that represents objects of this type on the API server.",
19
19
Required: true,
20
20
},
21
+
"query_string": &schema.Schema{
22
+
Type: schema.TypeString,
23
+
Description: "An optional query string to send when performing the search.",
24
+
Optional: true,
25
+
},
21
26
"search_key": &schema.Schema{
22
27
Type: schema.TypeString,
23
28
Description: "When reading search results from the API, this key is used to identify the specific record to read. This should be a unique record such as 'name'.",
ifdebug { log.Printf("datasource_api_object.go: Locating '%s' in the results", results_key) }
98
110
/* First verify the data we got back is a hash */
99
111
if_, ok=result.(map[string]interface{}); !ok {
100
-
returnfmt.Errorf("datasource_api_object.go: The results of a GET to '%s' did not return a hash. Cannot search within for results_key '%s'", path, results_key)
112
+
returnfmt.Errorf("datasource_api_object.go: The results of a GET to '%s' did not return a hash. Cannot search within for results_key '%s'", search_path, results_key)
ifdebug { log.Printf("datasource_api_object.go: results_key is not set - coaxing data to array of interfaces") }
112
124
ifdata_array, ok=result.([]interface{}); !ok {
113
-
returnfmt.Errorf("datasource_api_object.go: The results of a GET to '%s' did not return an array. Perhaps you meant to add a results_key?", path)
125
+
returnfmt.Errorf("datasource_api_object.go: The results of a GET to '%s' did not return an array. Perhaps you meant to add a results_key?", search_path)
0 commit comments