Hi all,
we have a custom API built. FYI This uses Azure API Management to route the requests to other backend services. So we do not want to use Zapier or those tools.
Up to this point we have been using Javascript in ‘Classic’ to call this api
$(document).on('knack-form-submit.view_127', function(event, view, record) {
handleWebhookSubmission(record, 'POST', 'https://ourapi.com/knackwh/orders')
});
the handleWebhookSubmission sends the request and captures the response from the api with some retry logic… In essence it uses Javascript fetch:
fetch(props.url, {
method: props.method,
headers: {
'Content-Type': 'application/json',
'user-token': Knack.getUserToken(),
'x-api-key': 'yes_this_is_a_security_issue',
'x-environment': 'DEV'
},
body: props.data ? JSON.stringify(props.data) : undefined
})
We want to replace this with something more secure.
Questions
-
how would I write this code in the New Gen Javascript? Does the new gen allow for a more secure option?
-
Can somebody confirm that the HTTP Request Flow action does not support a request body for a POST request. The beauty of the current solution is that the data of the record gets sent to the api so I can do the further processing easily
Thank you