Ask a Question

Cannot upload an image using SoapUI - Petstore UploadImage API

SOLVED
merxyboy
New Contributor

Cannot upload an image using SoapUI - Petstore UploadImage API

Hi SmartBear community,

 

I have imported the sample petstore wadl from Swagger and am currently trying the UploadImage API. However, no matter what I do (searched all over the internet for answers), SoapUI always return a 405 Not Allowed error.

 

I have tried doing it in the test case and making the media type same with the content type of the object.

 

Kindly help.

 

Thanks,

Jose

4 REPLIES 4
nmrao
Community Hero

What does it show for "Part" in the attachment section? Should have some id in the drop down, have you tried selecting that?


Regards,
Rao.
HKosova
SmartBear Alumni (Retired)

1) Change the petId parameter type to TEMPLATE.

2) Change the file parameter value to file:hqdefault.jpg (not cid:...)

3) Change Media Type to multipart-form/data.

4) Select the Post QueryString check box.

 

This should do the trick.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

Hi Rao - there is no content on Part dropdown. See attached image.

 

Hi Helen - Thanks! Your solution worked 🙂

 

If you are still able to reply, I'd like to confirm if the image is actually sent somewhere? Probably to photoURLs of the pet object? or is it sent to a ./null per screenshot?

 

Just curious since our integration testing would involve something like this and would like to know how it would actually work.

 

Cheers,

Jose

HKosova
SmartBear Alumni (Retired)

Hi Jose,

 

One more thing - the parameter value should be file:hqdefault.jpg, not cid:hqdefault.jpg. I updated my answer above to reflect this. The "./null" response was caused by cid: and the file being uploaded differently than uploadImage expects.

 


merxyboy wrote:

I'd like to confirm if the image is actually sent somewhere? Probably to photoURLs of the pet object? or is it sent to a ./null per screenshot?


On success, the uploadImage response includes the uploaded file name and size:

"message": "additionalMetadata: GoldenRetriever\nFile uploaded to ./hqdefault.jpg, 22019 bytes"

In the Petstore demo, the uploaded images are not actually used in pet data. Here's the method code for the reference. The response text is the only way to verify successful file upload.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: