Forum Discussion
9 Replies
- MarcusJ
Staff
Hi Simon,
Can you attach a screen shot of the 'put parameters in body' checkbox? I do not see that for
attachments when using a REST POST request. A screen shot would further clarify this.
Regards,
Marcus
Smartbear Support - testspayceOccasional Contributor
Hey Marcus, yes. Here it is.
Without checking the box we return:
<Response xmlns="http:/...">
<description>file stream is null</description>
<errorCode>-100</errorCode>
<success>false</success>
</Response>
When I check the box, we return:
<Response xmlns="http:/...">
<description>session Id required</description>
<errorCode>-100</errorCode>
<success>false</success>
</Response>
I can't ask to change the API, I don't see why all or none params have to be in the body. Seems a clear difference between file and query params?
thanks
Simon - MarcusJ
Staff
Hi Simon,
I believe what you are trying to achieve can be done by the following way:
You need to copy the parameters and put them in resource text area.
Then remove the parameters in the body area.
Check doc for example screen shot. - testspayceOccasional ContributorDear Marcus,
thank you for your time and effort but the situation is slightly complicated. I cannot make JSON requests, multipart form data is required. I also must put the QUERY parameters in the URL. See below. These are requirements that I cannot readily change.
<html>
<head>
<meta content="HTML Tidy for Java (vers. 26 sep 2004), see www.w3.org" name="generator"/>
<title>Apache Tomcat/7.0.40 - Error report</title>
<style type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
</head>
<body>
<h1>HTTP Status 415 - Unsupported Media Type</h1>
<hr noshade="noshade" size="1"/>
<p>
<b>type</b>
Status report
</p>
<p>
<b>message</b>
<u>Unsupported Media Type</u>
</p>
<p>
<b>description</b>
<u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u>
</p>
<hr noshade="noshade" size="1"/>
<h3>Apache Tomcat/7.0.40</h3>
</body>
</html>
and when I check "Post QueryStr.."
<Response xmlns="http://..">
<description>session Id required</description>
<errorCode>-100</errorCode>
<success>false</success>
</Response> - MarcusJ
Staff
Hi,
The application/json request is irrelevant to what I was trying to convey in the screen shot. I was trying to show that the query params can be put in the Resource instead of the body. You can use multipart form data if that is required for your request. I hope this clears up any confusion. If not let me know.
Thanks. - testspayceOccasional ContributorAw right, I missed that. Looks like some old fashioned handwork then. peace!
- testspayceOccasional ContributorHey Marcus,
I just tried your suggestion and it does work, however, if I want to transfer properties, how do I transfer for example a sessionId from the respone to the URL of the following request?
thanks
Simon - testspayceOccasional Contributor
- Right, {parametername} in the resource creates a TEMPLATE style of parameter: http://www.soapui.org/REST-Testing/unde ... eters.html
You can also define style/type of parameter HEADER, so that you can pass values into HTTP Header fields.
Thanks,
Michael Giller
SmartBear Software