Cannot upload an image using SoapUI - Petstore UploadImage API
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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. ⬇️⬇️⬇️
