Forum Discussion

Terkon's avatar
Terkon
Contributor
5 years ago

REST + environments: Need to be able to edit the endpoint when not using the default environment

Hi all,   when working with REST and environments I encounter the problem that I cannot edit the endpoint to my REST service when NOT using the default environment. As soon as I switch to a custom...
  • richie's avatar
    richie
    5 years ago
    Hey Terkon,

    If im understanding correctly youre saying you cant edit your endpoint URLs whilst editing a teststep view?
    Thats right...right? Cos the screenshot you took was of a teststep i think.

    What version of ReadyAPI! are you using? Reason i ask this is that the reasons you shouldnt be able to do this were more obvious several versions back when you selected either Projects tab to create and edit your APIs and SoapUI tab to create and edit testcases.

    The URL you are using in a test step is setup in the API section (previously the Projects tab) and if you think of it as a parent/child relationship between the API (parent) and the teststep (child), then you wouldnt be able to alter the child because if that was allowed youd also be trying to update the parent record details.

    I dont understand why you can edit the child teststeps API details in a specific environment....that sounds like a defect to me based on how ReadyAPI worked previously (yes i appreciate the Projects/SoapUI tabs are no longer present and you edit APIs and testcases that all appear in the same frame now (like open source SoapUI), but that's just a UI overlay so its not surprising the underlying functionality hasnt changed), so i wouldnt expect you to be able to edit any API URL via a teststep.

    Using what you posted as a description:

    If this is my endpoint:
    https://myendpoint.com/

    Then for one testcase I want to call
    https://myendpoint.com/en/function1

    and for another one
    https://myendpoint.com/en/function2

    So! I'd setup my APIs considering the previously more obvious parent/child relationship when you were setting this up on the older version of ReadyAPI! (with the Projects and SoapUI tabs), and i would setup a single REST request with the following details,

    https://myendpoint.com/en/{templateParameter}

    Just to be clear, id setup a new service with the above URL which has a URI of en/{templateParameter} which would ensure youd have a uri/template parameter in the URI path at the folder immediately after the 'en' folder.
    This approach will enable you to set whatever value you want to in the test step editor.

    It's actually been about 6 months since ive setup any new services/APIs in ReadyAPI! so i haven't done it in the most recent versions without the Projects/SoapUI tabs so i'm not 100% positive on this, but i'm 99% positive this will work. At least its worked for me several times before.

    I'll give it a shot tonight when i get home on the latest version of ReadyAPI! and then reconfirm, but thats really just belts and braces. Im positive it still works like how ive described.

    Ta

    Rich
  • Terkon's avatar
    Terkon
    5 years ago

    Hi Richie,

     

    thanks again for your input.

    While trying to implement your approach I found the option to add "resources" to an REST API, which can exactly be the "/en/function1"  or "/function2" from my example.

     

    With these entered, one for each function, I am able to assign these to an example request in the API definition and transform it into a real teststep.

    Or I can use the "link API" button in the top right corner in the teststep editor for an already existing teststep and link it so the API with the needed resource.

    It is not the most practical or handy thing, but it works and kind of make sense to me.

    Rg

    Terkon