Forum Discussion
I have what seems like a similar issue with a get operation getting a device by ID. When I set the ID manually in the request it returns a single device as expected. When I set the ID with an environment variable authentication fails with a 1401 code returned. The headers and request path look identical in both cases. Was there a resolution found for the original post?
Working request with ID 5 set statically in the request:
{{url}}/device/devices/5 sends: GET https://(company).logicmonitor.com/santaba/rest/device/devices/5
Broken request with id variable set to 5:
{{url}}/device/devices/{{id}} sends: GET https://(company).logicmonitor.com/santaba/rest/device/devices/5
I tried modifying the pre-request script as well and had the exact same results. Script modification:
var id = pm.environment.get('id'); var request_vars = (http_verb == 'GET'||http_verb == 'DELETE') ? http_verb + epoch + resource_path + id: http_verb + epoch + request.data + resource_path;
Related Content
- 3 years ago