Forum Discussion

Anastasiya1991's avatar
Anastasiya1991
New Contributor
3 years ago

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!

1 Reply

  • richie's avatar
    richie
    Community Hero
    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,