Hello everyone,
i try to build an application that speaks to an REST-API of another server.
Most of the commands work but there is one command that seems to do something different.
So in curl i can do this:
curl --digest -u 'user:pass' -k -X GET https://10.80.6.40/api/v1/media/usage/source?refs=3
and that (mind the -g option and the array at the end)
curl --digest -u 'user:pass' -k -X GET -g https://10.80.6.40/api/v1/media/usage/source?refs=[3,7]
which reponses json-arrays based on the given ref-ids:
[
{
"bitrate": 42580237,
"connections": 0,
"id": 3,
"reference": "87e2c69d-32b2-48d5-9ad",
"status": "active",
"uptime": 430177
}
]
[
{
"bitrate": 42580090,
"connections": 0,
"id": 3,
"reference": "87e2c69d-32b2-48d5-9ad",
"status": "active",
"uptime": 430184
},
{
"bitrate": 4003686,
"connections": 1,
"id": 7,
"reference": "9577acf3-222c-430b-bf0",
"status": "active",
"uptime": 430184
}
]
In Node-RED i've testet it with that:
[
{
"id": "e2338b4dc51d008c",
"type": "http request",
"z": "77330981809b0bcf",
"name": "GET",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://10.80.4.40/api/v1/media/usage/source?refs=3",
"tls": "f23433ca4be8ca58",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "digest",
"senderr": false,
"headers": [],
"credentials": {},
"x": 510,
"y": 300,
"wires": [
[
"825f4de8189b13e5"
]
]
},
{
"id": "9a7eb8c80174a1cb",
"type": "inject",
"z": "77330981809b0bcf",
"name": "Dec B 01 usage",
"props": [
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 240,
"y": 300,
"wires": [
[
"e2338b4dc51d008c"
]
]
},
{
"id": "825f4de8189b13e5",
"type": "debug",
"z": "77330981809b0bcf",
"name": "debug 9",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 800,
"y": 260,
"wires": []
},
{
"id": "f23433ca4be8ca58",
"type": "tls-config",
"name": "",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"servername": "",
"verifyservercert": false,
"alpnprotocol": ""
}
]
but i get error 400 - Bad Request:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>400 Bad Request</h1>
</body>
</html>
I asked the system-support of that software-product and they gave me the hint to use -g option which helped for cURL but how to do that with http-requests?
Thanks