Forum Discussion

AhamedShaik's avatar
AhamedShaik
Occasional Contributor
7 years ago

How to change resource path for different environments.

Following is my scenario: Using Ready API.   I'm working with  different environments ( dev, test & staging) the requirement here is utilizing the same test scenario for different environments.   ...
  • Bill_In_Irvine's avatar
    Bill_In_Irvine
    7 years ago

    First of all, I presume you are using the top set of lines. I see that the magic number 24 is used. That is longer than the length of your API (in bytes). That will make it not work.

     

     

    there are 22 characters in "http://dev.company.com" and 23 characters in the "http://test.company.com" in your original post. In my response to you there is a link to a solution I made to someone else told that person to figure out the byte length.

     

    My suggestion is change 24 to 22 and just test for now in the dev environment.

     

    Then change 22 to 23 and use the test environment.

     

    The line below is something to ignore "//" is a comment. It's java-like, C++-like

    //String resourcepath = new String(therequestUri.substring(beginindex, endindex))

    As for the output I see

    /rail/rs/V1/tsearches  and
    /rail/sohail/V1/tsearches

     

    It looks as though somehow it sees two resource paths. Possibly to do with using the wrong number on the API size.

     

    Take small steps. Test with one environment and one resource path.