katalon API Testing

Me New to Automation testing, In Katalon , On POST ,Method were I have to feed JSON param values

{ “firstName”: “Michael”, “secondName”: “Richards”, “emailId”: " Michael2003@mail.com", “designation”: “Developer”, “contactType”: “Technical”, “memberEmail”: " Michael2003@mail.com", “phones”: [{ “phoneType”: “Work”, “phoneNumber”: “0123456789” }, { “phoneType”: “Cell”, “phoneNumber”: “1234567890” }] }

Hi socrates4875

For the API testing with Katalon, you need to know more about the test endpoint, request header, request data, and the method.

I assume that you asked about how to send the POST request with that body data. You can put it under HTTP Body as below screenshot.

Let me know if you need more help.

Yes as it is mention above…you need to create variables and then specify those in the body of the request. Also another good idea once parameterized the request…is to parameterize the test calling the api…with the values you need…and then you can bind an excel file with a lot of rows to the test case…matching columns names with test variables. That is call data driven testing. Allows you to run same test with different data

Dear friend,

Task is to create new user member in our application.

In postman , I selected form data and provided userjson in key and passed json query in value . it created the user in my application

but on trying the same in katalon its not working .

In script

def request = (RequestObject)findTestObject(‘CLOUDAPI/CREATE-USER’)

String body = ‘{ “firstName”: “Saravanan”, “secondName”: “Ramamoorthy”, “emailId”: " Socrates4875@gmail.com", “designation”: “Tester”, “contactType”: “Technical”, “memberEmail”: " Socrates4875@gmail.com", “mobileNumber”:“9176684875”, “phones”: [{ “phoneType”: “Work”, “phoneNumber”: “0123456789” }, { “phoneType”: “Cell”, “phoneNumber”: “1234567890” }] }’

try {
request.setBodyContent(new HttpTextBodyContent(body, ‘UTF-8’, ‘application/json’))
}
catch (Exception ex) {
Println(ex.detailMessage)
}

Ws.sendRequest(request)

it alerts with message “No such property: Ws for class:”.

I don’t know what is missing. it would be great if you guide me on the same.

It seems like you might be missing the import:
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS