Ninox http Request broken; maybe during update?
Hi there,
just wanted to create a CRM trigger in my Ninox; that's basically an http call towards an n8n instance. It was built long ago and I didn't change it.
Unfortunatelly I received an error that the call failed.
Checking the Developer Console, I recognized that the HTTP Get Request tried to enqueue the Optional Headers to the HTTP Request:
let response := http("GET", "https://n8n.thatsnottherealurl.de/webhook/11111111-77777-4826-9e63-3d7518d8dfe3?client=" +
Id +
"&days=14", {
xAuth: "ljdfaljdflaefjlaejpeajeapjpjfae",
'Content-Type': "application/json"
});
if response.error then
alert(text(response.error))
else
alert("Trigger erstellt")
end
This lead to this HTTP Request:
https://n8n.thatsnottherealurl.de/webhook/11111111-77777-4826-9e63-3d7518d8dfe3?client=4307&days=14&{%22xAuth%22:%22ljdfaljdflaefjlaejpeajeapjpjfae%22,%22Content-Type%22:%22application/json%22}
So, header was included in the URL
Adding a null-Parameter seems to fix it.
let response := http("GET", "https://n8n.thatsnottherealurl.de/webhook/11111111-77777-4826-9e63-3d7518d8dfe3?client=" +
Id +
"&days=14", {
xAuth: "ljdfaljdflaefjlaejpeajeapjpjfae",
'Content-Type': "application/json"
},null);
if response.error then
alert(text(response.error))
else
alert("Trigger erstellt")
end
Can someone approve that this is an error?
I'm just a little unhappy to go through all of my application to fix it, so I would prefer a bugfix
1 reply
-
Hi Frank,
I observed this behavior a couple of versions ago, especially when you try something with Postman, and it works, but then try the same request structure inside Ninox, and it doesn't. Adding this "null" seems to solve a lot of otherwise non-working requests.
Here is our example for communicating with DHL label creation:
"##########################################################################################################"; "# DHL API "; "##########################################################################################################"; function _DhlApiTest() do do as server let einstellungen := (select _Einstellungen).{ parameter: Parameter, wertEnv: WertEnv }; let url := einstellungen[parameter = "_DhlApiUrl"].wertEnv; let request := einstellungen[parameter = "_DhlApiTest"].wertEnv; let auth := einstellungen[parameter = "_DhlApiAuth"].wertEnv; let key := einstellungen[parameter = "_DhlApiKey"].wertEnv; let response := http("GET", url + request, { Authorization: auth, 'dhl-api-key': key }, null); if response.error then false else true end end end;
POST-Requests are working fine, but every GET needs the "null":
function _DhlApiOrdersShipmentLabel(data : number) do do as server let v := first(select 'Versandaufträge' where Nr = data); let einstellungen := (select _Einstellungen).{ parameter: Parameter, wertEnv: WertEnv }; let url := einstellungen[parameter = "_DhlApiUrl"].wertEnv; let request := einstellungen[parameter = "_DhlApiOrders"].wertEnv; let auth := einstellungen[parameter = "_DhlApiAuth"].wertEnv; let key := einstellungen[parameter = "_DhlApiKey"].wertEnv; let param1 := "PDF"; let param2 := urlEncode(text(first(einstellungen[parameter = "_DhlApiPrintFormat"].wertEnv))); let param3 := v.ShipmentNo; let response := http("GET", url + request + "?docFormat=" + param1 + "&printFormat=" + param2 + "&shipment=" + param3, { Authorization: auth, 'dhl-api-key': key }, null); if response.error then formatJSON(response.error) else text(first(response.result.items).label.b64) end end end;
Content aside
- 4 mths agoLast active
- 1Replies
- 38Views
-
2
Following