1

Is there a way to have a parameter at the end of the URL for a Rest request?

This is the URL:

http://localhost:8000/my_user/1000

I've tried to use a parameter for the 1000, like so:

http://localhost:8000/my_user/${#Project#id_test}

This doesn't render 1000 at the end.

Is there a way to do this?

Rao
  • 20,781
  • 11
  • 57
  • 77
Tom
  • 1,055
  • 1
  • 14
  • 29

2 Answers2

3

There are REST resource parameter types.

In your case, style should be Template. That should resolve the issue.

To give an example:

While adding a new REST Resource from API use below url instead of plain text value.

enter image description here

In the request you would see as below:

enter image description here

Now, in your test cases, you can use the property expression (the one you were using in the question) i.e., ${#Project#id_test} for value field/column as underline in the above image.

You may also go thru documentation if needed.

Rao
  • 20,781
  • 11
  • 57
  • 77
  • Thank you Rao, I was away over the weekend. I'll give this a go today and accept as answer if it works. – Tom Nov 27 '17 at 08:42
0

What you're trying to achieve is possible, though I'm not sure about the value you have supplied.

When you set up a RESTful Test Project is SoapUI, you define the root/base url under test.

When you set up the service call in SoapUI, you define the GET, POST settings. In the same place, you can add parameters. Click on the Request tab and you should see an empty table with headings, Name, Value, Style, Level.

You can add your parameter here.

E.g.

   Name | Value | Style | Level
   id   | Smith | QUERY | RESOURCE

When you run the service call and you not sure your request is correct, click on the Raw tab and that will show what SoapUI is actually sending to your service.

Chris Adams
  • 1,376
  • 1
  • 8
  • 15