Hi,
I'll start this by saying that I don't know javascript at all, but I really want to figure out how to create a custom connector. So I was messing around and was able to get some data using the following partial script. What I want to do is to set the "resources" object of the response as a variable so that I can then append it to another URL to call which should finish this script.
Here's what I have so far:
httprequest.addHeader('Authorization', 'Basic ' + DOMO.b64EncodeUnicode(metadata.account.username + ':' + metadata.account.password));
var res = httprequest.get('https://URLREDACTED.com/devices/queries/devices/v1?filter=last_seen:>'2018-01-13'&limit=4000');
DOMO.log('res: ' + res);
if(res.indexOf('Account.Name') > 0){auth.authenticationSuccess();}
else{auth.authenticationFailed('Your username and password are incorrect');}
This returns json that looks like this:
res: {"meta":{"query_time":0.132349044,"pagination":{"offset":3719,"limit":4000,"total":3719},"powered_by":"device-api","trace_id":"e1f320ef-b17e-4b20-8155-1e762e1fd250"},"resources":["24ee11d64f3347894277a798b9a15958","21139027abb043115e696961ac512a28","77c2a8a4abcc4cbb6dd57e29e8c18622","74fa4890ddaa42c85ff139edd2df36a8","84b89dead05f41607f1735ec2d99172c"],"errors":[]}
I then want to take the "resources" from above and append it to the URL here:
def url = ('https://URLREDACTED.com/devices/queries/devices/v1?ids=' + VAR
var devices = httprequest.get(url); datagrid.magicParseJSON(devices);
Can anyone help a noob out?