Forum Discussion

forkbattery's avatar
forkbattery
Occasional Contributor
9 years ago
Solved

How do I prevent requests from different methods within the same resource defaulting to GET?

I'm testing a REST API at work. 

 
The REST API has many resource URIs. Now if I have a GET and a POST method under one resource URI and I add requests from both methods to a Test Case, upon opening a POST method request, it's defaulting to a GET method. 
 
Now even when I change it back to POST and save the project. When I close and reopen SOAPUI, the POST request again defaults to the GET request.
 
What am I doing wrong? Or what can I do to resolve this? 
 
This is important to rectify because if anyone is to use the Test Suite I create, they're going to have to manually open each POST request and change it from GET to POST. Same goes for DELETE requests.
 
I should also mention this:
 
If a resource URI has only a POST or only a DELETE or only a PUT method. Then any requests added to the test cases retain their actual methods and don't default to a GET request. 
  • I figured it out. For anyone having the same issue or wondering why this may be happening:

     

    I was giving the different methods (Get, Post, Delete), the same name, under one resource. 

     

    So for example if I had a resource named "bookid", I was calling the Get, Post and Delete methods all "bookid" for the sake of consistency in naming. But perhaps I was being too consistent. This is a bad idea. 

     

    I gave different names to each method under the same resource and it works fine now when adding it to the test case.

1 Reply

  • forkbattery's avatar
    forkbattery
    Occasional Contributor

    I figured it out. For anyone having the same issue or wondering why this may be happening:

     

    I was giving the different methods (Get, Post, Delete), the same name, under one resource. 

     

    So for example if I had a resource named "bookid", I was calling the Get, Post and Delete methods all "bookid" for the sake of consistency in naming. But perhaps I was being too consistent. This is a bad idea. 

     

    I gave different names to each method under the same resource and it works fine now when adding it to the test case.