How to manage subscription keys in Headers for different environments
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2021
08:31 AM
10-26-2021
08:31 AM
How to manage subscription keys in Headers for different environments
I have faced with the issue when each environment has their own subscription key which is set up in Headers (Ready API Version 3.10)
For example I have one API that should be possible to run in different environments. For that I change environment at the right top corner
However header remains the same that was set up only for 1 environment (for dev for example but for qa I should set up a different one)
Does anyone know how to do this in Ready API?
Thank you in advance!
Labels:
- Labels:
-
REST
-
Test Setup
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2021
09:38 AM
10-26-2021
09:38 AM
Hey @Anastasiya1991
I might be misunderstanding your issue, but are you saying that a certain custom header is environment specific?
If this is correct you can paramaterise the header value.
The way i setup my project for each environment is to create a properties file....1 per enviroment and include in the file all the different environment specific parameters. I then load the file in before executiom depending on which environment i want to test against
So in your scenario id create 2 properties files, each containing project level properties, so in your scenario, each file would include the header value you need to set.
Then within the API, id update the http header value to '${#Project#header}'
I actually do the above in all my readyapi projects now. I paramaterise every single environment specific parameter resulting in zero hard coding of these values. This allows me to lift and shift my projects to other enviroments without having to change ANY of the content in my readyapi/soapui projects (other than loading in the properties file immediately before execution).
Cheers
Rich
For your scenario,
I might be misunderstanding your issue, but are you saying that a certain custom header is environment specific?
If this is correct you can paramaterise the header value.
The way i setup my project for each environment is to create a properties file....1 per enviroment and include in the file all the different environment specific parameters. I then load the file in before executiom depending on which environment i want to test against
So in your scenario id create 2 properties files, each containing project level properties, so in your scenario, each file would include the header value you need to set.
Then within the API, id update the http header value to '${#Project#header}'
I actually do the above in all my readyapi projects now. I paramaterise every single environment specific parameter resulting in zero hard coding of these values. This allows me to lift and shift my projects to other enviroments without having to change ANY of the content in my readyapi/soapui projects (other than loading in the properties file immediately before execution).
Cheers
Rich
For your scenario,
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
