Katalon Analytics (beta) – Bringing new insights into test reports. Learn more!

Is it possible to use variables in Web Service URL?

Hi there -

I'd like to use a variable in Web Service object's URL. Is it possible?


Something like: GET {GlobalVariable.katalonUrl}/path/to/something

And katalonUrl is "http://www.katalon.com"


Thank you.


  • Hi there,

    Regard to your question: Katalon Studio didn't support from test object view. However, you are freely to do this in test script  using 'setRestUrl' function, e.g:

    RequestObject request = findTestObject('REST_CommentDetails')

    'Change Rest URL'
    request.setRestUrl(GlobalVariable.katalonUrl + "/path/to/something")

    'Send a REST request after its URL has been changed'
    def response = WS.sendRequest(request)

    There are also lots of APIs to support you changing request / response object in test script. Please refer to these APIs docs:


  • Never mind, this is great solution, too.
    You guys rock! I really appreciate your help here. Thank you!!!
  • Hi Marek, I find the next solucion

    I use the replace method, first in the request change de fix value por a any variable, next I use the replace the value and next set for setter the value.

    Name and Value for Request

    {"CustomerMng_ConsultaCliente_Request":{ "Header":{ "SecurityHeader":{ "User":"UsrPortal", "Password":"PasswdPortal"}, "System":{ "InputSystem":"Portal", "ApplicationID":"SWPR108", "TransactionID": "10111516", "IPAddress ": "192.168 .0 .1 " }}, "Body": {"Cliente": {"TipoIdentificacion": "TipoId", "NumeroIdentificacion": "NumId", "Id":"1", "TipoIdResponsable":"TipoIdRespo", "NumeroIdResponsable":"NumIdRespon", "OpcionConsulta":"OpcionCon" }}}}
    RequestObject serConsultar = findTestObject('ConsultarCliente')

    Test Case (Script Mode)
    a = serConsultar.getRestParameters().get(0).getName().replace('NumId', NumeroIdentificacion).replace('TipoId', TipoIdentificacion).replace(
    'TipoIdRespo', TipoIdResponsable).replace('NumIdRespon', NumeroIdResponsable).replace('OpcionCon', OpcionConsulta)


    ResponseObject response = WS.sendRequest(serConsultar)

Sign In or Register to comment.