Ask a Question

Parameters in Multipart Form Data Request

jneth
New Contributor

Parameters in Multipart Form Data Request

I am creating a REST project that will be for a multipart form data request. I am trying to make it as simple as posible so that other testers on my team would not have to change too much. I was wondering if there is a way to parameterize the query parameters. I have two query parameters that I would like to do this with.

 

First, the file attachment. Is there a way after attaching the file to the request through the attachments tab to pass the file name to the query parameter? I know it is minor, I am just trying to avoid having to have others attach the file and then add the file name to the query parm. Ideally, I want to see something like value = file:${#AttachmentFileName} for a query parm.

 

Second, the payload. Similar question to above. I would want to pass values into the payload. I know that I can right click and get data from a previous test step, but there are a couple challenges with that. First, everytime you right click and get data, Ready API clears any existing data in the value. So, I would have to build the entire payload outside of Ready API and paste it back into the value of the query parm. Secondly, the value is one box and formats the payload in one long string, making it very hard to read. Is there a way that I could use the text box below the Media Type down box/ Post Query String check box and pass the contents of that back to query parm? 

 

I have attached screen shots of the areas that I am referring to in case it is not clear.

 

Thanks in advance for any help.

 

 

3 REPLIES 3
TanyaYatskovska
Community Manager

Re: Parameters in Multipart Form Data Request

Hi Jneth,

 

 

By using the Get Data feature, you can simply get data from a request, or project properties and use this data in another requests or in Groovy scripts. I recommend that you read the following article and those related:

http://readyapi.smartbear.com/features/get_data/start

 

Please let me know if you have anymore questions.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
jneth
New Contributor

Re: Parameters in Multipart Form Data Request

I understand the Get Data function. As mentioned above, I use it in other areas. I figured out the payload part of my question, but I am just not sure what to pass in the get data for the attachment file name as I mentioned above. 

tech321
Contributor

Re: Parameters in Multipart Form Data Request

I have the same issue and I appreciate a solution, or a workaround, so I do not need to hardcode the attached file name. My plan is to build a datadriven test and in every iteration I attache a new file.  

cancel
Showing results for 
Search instead for 
Did you mean: