How to use variables for Web Service Requests

Is it possible to use variables for Web Service Requeststhe same way like in Postman’s enviroments variables?

The main idea is to swith between production and test profiles


What do you want to have as variables? I have sent headers using variables (bearer token), didnt use global profile variables mind, but think it would still work. Do you want to change the URL?

Below is how I used a variable in an API request

        'Set up API Request Object'
    RequestObject request = findTestObject('delete')
    'Create new array for headers'
    ArrayList<TestObjectProperty> HTTPHeader = new ArrayList<TestObjectProperty>()
    'Add accept header details'
    HTTPHeader.add(new TestObjectProperty('accept', ConditionType.EQUALS, 'application/json'))
        'Add Authorization header details using access token previous obtained'
    HTTPHeader.add(new TestObjectProperty('authorization', ConditionType.EQUALS, 'bearer ' + accessToken))
        'Set new headers'
        'Send Tenant Deletion Request'
    response = WS.sendRequest(request)

The only thing my web service test object ‘delete’ had was the correct URL