Forum Discussion

divman's avatar
divman
Contributor
10 years ago

How to parameterize REST resource/method

Hi,

I have a REST API like below. The Business Id and User Id are the encrypted part in the URL, which will how the REST URL will be passed from client side. i have to parameterize that business id and user id for my test scenarios. But after i create a test suite i couldn't parameterize that from data source. How should i do that?

<host>/smallbusiness-user-accessrole/small-business/businesses/BovyMcOm8Sv2FhkwCsPkzJCJJbRZO6SWych%2FTSNDmYOnTyGIbkCXK9gkCpSnMg3x/users/OMfF7xCp9tPuiwMINXg%2BQMMM3eXaGqxz7%2FhQXNEn8T8%3D

can any help me. i need it ASAP...

2 Replies

  • Hopefully I can help, although I'm fairly new myself.

    If you have an authenticate step that creates these IDs, you can use a Property Transfer to transfer them to a variable. Variables can be set at a Global, Project, Test Suite, or Test Case level. (Here's a good link: http://www.soapui.org/Functional-Testin ... rties.html) On my project I've been using variables at a project level, so if you had a variable called BusinessID and UserID, your endpoint would look like this <host>/smallbusiness-user-accessrole/small-business/businesses/${#Project#BusinessID}/users/${#Project#UserID}

    If you want to set these as parameters, go to the Method level and just use these variables and it will work.

    For example, I have my authenticate method show as this: Endpoint: ${#Project#Endpoint}, Resource: /v1/m1/Organization, Parameters; ?Token=${#Project#Token}

    I learned all of this from that properties link above, so I hope that helps get you on the right track.