Back to All

How do I run onifyElevatedApiRequest from a script task?

(edited)

I am trying to run onifyElevatedApiRequest from a script task using users token but it does not work. Is it possible to run from a script task?

This is what I am trying to do:

let onifyHeaders = {
	'Content-Type': 'application/json',
	'Authorization': environment.settings.authorization
}

var resourceOptions = {
    url: `admin/resources/file?stream=false&path=${templatePath}`,
    headers: onifyHeaders
}
let result = await environment.services.onifyElevatedApiRequest(resourceOptions);