Ok…let me see if I can explain what I’m trying to do. I’m new at generating tests against API/Web Services. I am trying to take a String array of ids and use them in a HTTP Body as a way to delete records from a database.
The HTTP Body is:
[
“${idValue1}”,
“${idValue2}”,
“${idValue3}”,
“${idValue4}”,
“${idValue5}”,
]
The lines of code are:
response = WS.sendRequest(findTestObject(‘EntityAPI/data-objects/DELETE Entity By Ids’, [(‘host’) : GlobalVariable.host, (‘idValues’) : GlobalVariable.entId]))
GlobalVariable.entId = WS.getElementPropertyValue(response, ‘data[0].id’)
I am trying understand how to take my String Array of ids and pass them into what I think is supposed to be (‘idValues’). I think the person that left this code for me also wanted me to get the status code to verify the delete occurred and to verify that the response contains an id.
If someone can help, I’d greatly appreciated. Let me know if further information is needed.
Thanks for the response. I checked the API and it does have the five variables already assigned. I think I’m understanding you as saying that I also need to add them as Global Variables? The one thing I definitely need to know is how to pass the list of ids into the code to have the API call delete all records in this one call. I was told that if I don’t send all five ids then the call will fail. The code they provided above is what the person thought I had to do to get this to work, but they were not sure and never completed it.
Thanks for the help. I wasn’t able to get it to work with using the array. I was however able to get it to work by passing in each variable individually. I used ‘idValue1’ : idValue1, ‘idValue2’ : idValue2 and so on. I’ll try it again at a later date. Thanks again.