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
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'.",
29
+
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'. Similar to results_key, the value may be in the format of 'field/field/field' to search for data deeper in the returned object.",
ifdebug { log.Printf("datasource_api_object.go: Locating '%s' in the results", results_key) }
111
+
110
112
/* First verify the data we got back is a hash */
111
113
if_, ok=result.(map[string]interface{}); !ok {
112
114
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)
returnfmt.Errorf("datasource_api_object.go: The data at results_key location '%s' is not an array.", results_key)
122
+
returnfmt.Errorf("datasource_api_object.go: The data at results_key location '%s' is not an array. It is a '%s'", results_key, reflect.TypeOf(tmp))
121
123
}
122
124
} else {
123
125
ifdebug { log.Printf("datasource_api_object.go: results_key is not set - coaxing data to array of interfaces") }
124
126
ifdata_array, ok=result.([]interface{}); !ok {
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)
127
+
returnfmt.Errorf("datasource_api_object.go: The results of a GET to '%s' did not return an array. It is a '%s'. Perhaps you meant to add a results_key?", search_path, reflect.TypeOf(result))
126
128
}
127
129
}
128
130
129
131
/* Loop through all of the results seeking the specific record */
130
132
for_, item:=rangedata_array {
131
-
hash:=item.(map[string]interface{})
133
+
varhashmap[string]interface{}
134
+
135
+
ifhash, ok=item.(map[string]interface{}); !ok {
136
+
returnfmt.Errorf("datasource_api_object.go: The elements being searched for data are not a map of key value pairs.")
0 commit comments