Error: "Error while submitting the templates" While Requesting API


I am trying to send a post request using the Request API to our custom Middleware API. When I do I receive a response with a 400 error “Error while substituting the templates”.

I have tried all the possible solutions found in the community but still getting the same response

Code Snippet

 var headers = {
                "Authorization": 'Bearer <%= access_token %>',
                "Content-Type": "application/json"
            var options = { headers: headers, body: JSON.stringify(user), isOAuth : true };

            var url = MIDDLEWARE_URL + "/addUser";
  , options)
             function (response) {console.log(response)}
             , err => console.log(err))

Any advice would be greatly appreciated

Thank You.

Hi Hassan,

Can you just try this and let me know if it works?

let url = MIDDLEWARE_URL + "/addUser";

let response = await,{
headers: { Authorization: "Bearer <%= access_token %>", "Content-Type": "application/json"},
body: JSON.stringify(user),
isOAuth: true


No, it is not working after adding await in the response

But I found a solution

I am passing one of the access_token in body object using secure params <%= access_token %>
but now after updating the the platform-version this is not acceptable so we can not use secure params in body object while requesting any API


1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.