Skip to main content
Question

api_key template replacement fails

  • December 8, 2022
  • 3 replies
  • 160 views

cardboard
Apprentice
Forum|alt.badge.img

Hi

The template replacement code does not work for our custom app.

let options = {
    headers: {
      Authorization: "Basic <%= encode(iparam.api_key) %>", 
      'Content-Type': 'application/json'
    }
  };

Response:

•    "Error while substituting the templates"
•    status: 400
•    errorSource: "APP"
 

We would appreciate your insights on what we’re missing.

The `options` are used when using `client.request.get`.

Did this topic help you find an answer to your question?

3 replies

zachary.king
Skilled Expert
Forum|alt.badge.img+16
  • Skilled Expert
  • 951 replies
  • December 8, 2022

Hello @cardboard, this looks correct and matches some code that I have utilized in production. I would suggest taking this over to the developer community, here, if you haven’t already. There, we can troubleshoot the issue and get it in front of the DevRel team to take a look at it.

Take care.


cardboard
Apprentice
Forum|alt.badge.img
  • Author
  • Apprentice
  • 1 reply
  • December 13, 2022

`api_key` should have been `apiKey`. That fixed the problem. Compare the key in your iparams.json vs the key you use in the code itself.


weishen412
Community Debut
  • Community Debut
  • 1 reply
  • March 14, 2023

Hi,

I was trying to use the template replacement code for our custom app but it doesn't seem to work. When I executed the code, I got the following error message: "Error while substituting the templates", along with the status code of 400 and the error source being "APP".

I am hoping to get some guidance from you on what could be the issue. The options variable is used when using client.request.get. Our app is related to Poquoson Replacement.

Any help or insights on this would be much appreciated. Thank you.