Forum Discussion

jneth's avatar
jneth
New Contributor
8 years ago

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.

 

 

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    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.

    • jneth's avatar
      jneth
      New Contributor

      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's avatar
        tech321
        Contributor

        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.