Hi Petru,
I think I understand what you are aiming for and I have a solution that should make sense for your setup.
We don’t offer a way to address your API token directly. This is for mainly security reasons. If someone was able to run a project, with a link to someone else API key, it could result in all sorts of issue.
Essentially, what you will need to do is set your APIKey as a variable that is accessible by the project.
You could enter the variable in, directly into the project variables - however working with your step template, there is a way that is a little more reusable and secure.
You have no doubt configured your Step Template correctly. Here’s a screenshot of the step-template I’ve created, replacing the apiKey variable. I’ve used the variable “APIKeyToUse” - it should look something like this:
Next, for clarity and reusablity, you should consider a Variable set. This is especially handy if this key will be used in multiple locations along with complementing variables.
If you create a Variable Set, i.e. “Access Token Variable Set”, create a senstive variable inside of the Variable Set called “ActiveAPIKey” and fill it in with your api-key. I have created a plain text variable in this case, just for the example:
You can then link the variable set to the project, that is running the Step Template.
When filling in the Parameter value in the Project Step, set it to #{ActiveAPIKey}.
Finally, when configuring the Linked Step template within the project, bind the parameter “ApiKeyToUse” to the variable #{ActiveAPIKey}
As you can see from the logs, the API-Key gets calculated.
03:04:36 Error | At C:\Octopus\Tentacle\Work\20210121030423-16727-3\Script.ps1:1 char:116
03:04:36 Error | + ... PROJECT' -H "X-Octopus-ApiKey: API-12345678900000000000"
I hope this makes sense, but please reach out if you get stuck.
Regards,
Dane