Problem With POST request and verify response

Hi Guys,
i tried to create post request and verify the respone, i followed tutorial from katalon doc

i use API from

this is my script

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import as Windows
import internal.GlobalVariable as GlobalVariable
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.impl.HttpTextBodyContent
import com.kms.katalon.core.testobject.ConditionType
import java.util.List
import java.util.concurrent.locks.Condition
import java.util.ArrayList
import java.util.Arrays.ArrayList

def request = (RequestObject)findTestObject('Object Repository/User/POST')

String body = '{ "name": "Alex Martha" , "Job": "QA"}'

	request.setBodyContent(new HttpTextBodyContent(body,"UTF-8","application/json"))
catch(Exception ex){

request.setBodyContent(new HttpTextBodyContent(body,"UTF-8","application/json"))

def response = (RequestObject)findTestObject('Object Repository/User/GET')

List<TestObjectProperty> params = new ArrayList();
params.add(new TestObjectProperty("name", ConditionType.EQUALS, "Alex Martha"))

def result = WS.sendRequest(response)
WS.verifyElementPropertyValue(result, "name[0]", "Alex Martha", FailureHandling.STOP_ON_FAILURE)

when i run that script i got error from my console

Any suggestion how to fix that ?

You need some import statements.

import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.testobject.ConditionType

thanks @kazurayam

that’s fix my previous error, bu after that i found new error

do you have any suggestion how to fix that error ?

You should remove the following line, which is wrong. This line confuses Groovy.

thank @kazurayam

I just realized if it is entered even though it is not used, an error will occur,

but next problem its, why i cannot verify my element property value, its say null, buat i already give value in post statement and the post are successfull


this is the error

is there anything i missed ?

The second argument "name[0]" looks strange. That should be "name" possibly.

Thanks for your help @kazurayam

apparently after I tried there was an error in the header in the web service request method get

now it’s working