Contributions
Re: Interactive API Docs 'Try it out!' Headers
Hi again I am very grateful that you're working on my issues. Do I understand correct that I can add a cookie header to a request, and it will exists in the request, which comes directly into the web application, but I can not get cookie header in the response? I'm just trying to add a Cookie header to my request through parameters, but I still can't see it in the request that comes to web app. Here is my spec: parameters: - name: Cookie in: header type: string default: "Some Cookie"3.8KViews0likes2CommentsRe: Interactive API Docs 'Try it out!' 502 Bad Gateway
I have set up "schemes", "host" and "basePath". URL and protocol are correct. My spec looks like this: swagger: '2.0' schemes: - https host: demo.example.co basePath: /myappexample/api/v1 502 Returns to me only when my parameters in body are correct and I expect to recieve 200 OK. When my parameters are incorrect (empty or missing) I receive expected responses with my web app's errors in response body. Besides some other simple GET requests works fine. And when I paste proposed curl to my command line it works fine too. When I use curl response looks like this: HTTP/1.1 200 OK Server: nginx/1.6.2 Date: Wed, 04 May 2016 12:27:34 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive X-XSS-Protection: 1; mode=block X-Frame-Options: DENY Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' https://setronica.atlassian.net https://gdata.youtube.com www.google-analytics.com https://www.googleapis.com https://www.youtube.com http://www.youtube.com; img-src 'self' data: https://www.gravatar.com https://setronica.atlassian.net https://www.paypalobjects.com www.google-analytics.com; object-src 'self' https://www.googleapis.com https://www.youtube.com www.google-analytics.com; Pragma: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Cache-Control: no-cache Cache-Control: no-store Set-Cookie: JSESSIONID=6963E2C98E063E751820DA8A33EB1197; Path=/myappexample/; HttpOnly { "name" : "MyApp API", "version" : "1.0" }9.4KViews0likes0CommentsInteractive API Docs 'Try it out!' Headers
Hi, I tried to add 'Cookie' header to my request, but there isn't this header in request that comes to web app. Here is my header spec: parameters: - name: "Cookie" in: header type: string default: "someCookies" I also tried to add header through securityDefinitions. I define my security definitions: securityDefinitions: cookie: name: Cookie type: apiKey in: header And add security: - cookie: [] to my request operation. But I can't see anything related to security at Interactive API Docs page. And header isn't added. Are there any restrictions on what headers I can add to my requests when I use 'Try it out!' operation? Or am I doing something wrong? Thanks in advance for your assistance. Nikita.Solved3.9KViews0likes5CommentsInteractive API Docs 'Try it out!' 502 Bad Gateway
Hi, I have an API that I'm describing on "swaggerhub.com." When I send post request with parameters in json body using 'Try it out!' operation, it returns: Response Body <h1>Bad Gateway</h1> Response Code 502 Response Headers { "cache-control": "no-cache, no-store, must-revalidate", "content-type": "text/html; charset=UTF-8", "date": "Wed, 04 May 2016 07:04:10 +0000", "server": "nginx/1.8.0 + Phusion Passenger 5.0.22", "status": "502 Bad Gateway", "content-length": "20", "connection": "keep-alive" } Here is the specification of this request: /login: post: summary: "Some summary" description: "Some description" operationId: login parameters: - name: "Accept" in: header type: string default: "application/json" - name: "Content-Type" in: header type: string default: "application/json; charset=utf-8" - name: body in: body required: true schema: $ref: '#/definitions/login' responses: '200': description: "OK" schema: $ref: '#/definitions/apiVersion' '400': description: "Bad request." schema: $ref: '#/definitions/commonError' '403': description: "Forbidden." Here is definitions: definitions: login: type: object required: - key - secret properties: key: type: string secret: type: string apiVersion: type: object properties: name: type: string version: type: string sessionId: type: string When I use curl it returns exactly what I need. When I send incorrect parameters it returns error responses that I expect. I cant find where is the problem. Is there something I am doing wrong? Thanks in advance for your assistance. Nikita.Solved10KViews0likes11CommentsInteractive API Docs 'Try it out!' does not set "Accept" header
I describe API model on swaggerhub.com and trying to send POST request with parameters in body using 'Try it out!' operation. It returns response with status '406 Not Acceptable'. However when I copy Curl that suggests swaggerhub and paste it to command line it works fine. There is no header "Accept: application/json" in request that comes to web app when I use 'Try it out' operation. In the description of my POST operation there is field produces: - application/json I tried to add header using parameters: parameters: - name: "Accept" in: header type: string default: "application/json" But result doesn't changed at all. When I change header in parameters, I can set changes in represented curl, but result is the same. Is there something I am doing wrong? Thanks in advance for your assistance.Solved4.1KViews0likes6Comments