ngolubchuk
9 years agoOccasional Contributor
Interactive 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.
Hi Nikita,
Just a note: we've deployed to production with several fixes, including the try-it-out fixes we've been going over with you.
Thanks for pointing them out, it really helps!
Have an awesome weekend,
Josh