-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post method with zip file #1017
Comments
Tryoperation has some bugs, specially with file uploads. Maybe we should refactor it. |
Thanks, what do you mean by try operation? How to track any progress on this? |
Try Operation is the component you see after you click on |
Hi, @webron mentioned that this feature request was added for the next proposal (Dec 2, 2014). Is there any news on this? Alternatively @webron also mentioned that vendor extensions can be used to extend this functionality. Could you point to those vendor extensions? |
There's no solution for it yet, and we haven't covered that in the talks about the next version of the spec. Vendor extensions are pretty much your extensions that you write, they will not add functionality magically, but they can be used by various tools to extend the functionality. If you want a tool to understand your extension, it's up to you to modify it to support it. |
Alternatively, @webron is there any way to send the file in the body, like the equivalent in curl: curl -X POST --verbose --data-binary "@aggregatedNoFolder.zip" -H "slug: mytest2" -H "Accept: application/json" -H "Content-Type: application/zip" -H "Authorization: Bearer 4e5b6138-5885-4c8f-a794-cf368c67a4e4" http://sandbox.wf4ever-project.org/rodl/zip/create |
Sure, the tooling may not quite support it, but you can always say the method |
Thanks for the answer, but I am not sure how would you do something like this in the swagger file. I can say that the file parameter is in body, but how to send it ? how would you define the parameter to pass the zip file to the service (e.g., zipfile parameter in the example below) @webron ? parameters:
- name: slug
in: header
description: Identifier of the research object.
type: string
- name: zipfile
in: formData
description: content in zip format
type: file something like this won't pass any file: -name: zipfile
in: body
description: content in zip format
schema:
type: string |
I don't really understand the question. |
The question is how can you send a zip file in a POST method from the swagger file, to achieve the same behaviour as the curl command below: curl -X POST --verbose --data-binary "@aggregatedNoFolder.zip" -H "slug: mytest2" -H "Accept: application/json" -H "Content-Type: application/zip" -H "Authorization: Bearer 4e5b6138-5885-4c8f-a794-cf368c67a4e4" http://sandbox.wf4ever-project.org/rodl/zip/create At the moment I can send the file using parameter type "formData", but I cannot say that its a zip file, as the consumes has to be "multipart/form-data", so I receive Status Code:415 Unsupported Media Type. With a parameter type "body", as you proposed, I don't see how can I send a file. |
Okay, let's separate things. Do what you want to do, you'd need to set it as a body parameter. The tools, specifically, the editor and the ui, do not support this form of file upload, and I doubt they will soon. |
This PR may has fixed this issue. |
This issue should be fixed with the latest PR #1141 . Please let us know if you still see the issue. |
Swagger File
Issue
Hi,
I am trying to use the method "/zip/create" above, but I am unable to send correctly the request. After reading documentation, I understand in order to post a file you need to send it using "formData" and type "file", and use "multipart/form-data" in the consumes parameter. However, this returns: Status Code:415 Unsupported Media Type (see screenshot below). I cannot find the way to specify the "application/zip" as well in the call. How is this possible?
Thanks in advance.
Raul
You can test using the authentication: Bearer 4e5b6138-5885-4c8f-a794-cf368c67a4e4
![screen shot 2016-07-22 at 17 21 34](https://cloud.githubusercontent.com/assets/557493/17062012/77306ae8-5031-11e6-8d08-2f7855581373.png)
The text was updated successfully, but these errors were encountered: