A
A
Alexey Dugnist2016-01-21 17:37:22
Computer networks
Alexey Dugnist, 2016-01-21 17:37:22

Why doesn't swagger get a response with "Try this operation"?

With the help of editor.swagger.io I made the GET request markup.
source:

swagger: "2.0"
info:
  version: 1.0.0
  title: Documents API
  description: A sample API that demonstrates Box.com works
host: view-api.box.com
basePath: /1
consumes:
  - application/json
produces:
  - application/text
securityDefinitions:
  apikey:
    type: apiKey
    name: Authorization
    in: header
schemes:
  - https
paths:
  /documents:
    get:
      operationId: getDocuments
      tags:
        - users
      summary: ""
      description: |
        Gets a list of documents.
      security: 
        - apikey: []
      responses:
        200:
          description: Returns an array of MiniUser
        401:
          description: You are not authenticated
        403:
          description: Your user doesn't have suficient permissions
        429:
          description: Too many requests
        default:
          description: An unexpected error
          schema:
            $ref: '#/definitions/documents_collection'
definitions:
  documents_collection:
    description: List of a documents.
    type: object

When I press "Try this operation" - shows the following request:
GET https://view-api.box.com/1/documents HTTP/1.1
Host: view-api.box.com
Accept: application/text
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,fa;q=0.6,sv;q=0.4
Cache-Control: no-cache
Connection: keep-alive
Origin: http://editor.swagger.io
Referer: http://editor.swagger.io/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Authorization: Token ytoje08mar23k291tay3sndjl6hfz7uu

And finally, when I press "Send request" I get an error:
Headers
undefined
Body
Who knows what's wrong...?
Docks by view-api.box.com - https://box-view.readme.io/reference#documents-1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dugnist, 2016-01-22
@Peekab0o

The problem is still in the absence of CORS on the box.com server. The problem will be solved either if you download the swagger editor sources from github and rewrite the method for sending requests, or by some other request hack...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question