源文件:https://github.com/TykTechnologies/tyk-swagger-definitions/blob/master/tyk_gateway_api.yml
swagger: '2.0'
info:
version: "1.9"
title: Gateway REST API
paths:
/tyk/keys/:
get:
description: |
Gets a list of *key* IDs (will only work with non-hashed installations)
parameters:
-
name: api_id
in: query
description: Back-end to target
required: true
type: string
format: string
-
name: x-tyk-authorization
in: header
description: tyk gateway shared secret
required: true
type: string
format: string
responses:
200:
description: Successful response
schema:
type: object
properties:
keys:
type: array
items:
type: string
/tyk/keys/create:
post:
description: |
Create a new *API token* with the *session object* defined in the body
parameters:
-
name: x-tyk-authorization
in: header
description: tyk gateway shared secret
required: true
type: string
format: string
-
name: suppress_reset
in: query
description: Adding the `suppress_reset` parameter and setting it to `1`, will cause Tyk to not reset the quota limit that is in the current live quota manager. By default Tyk will reset the quota in the live quota manager (initialising it) when ADDing a key. Adding the `suppress_reset` flag to the URL parameters will avoid this behaviour.
required: false
type: number
format: integer
-
name: session_object
in: body
schema:
$ref: '#/definitions/SessionObject'
responses:
200:
description: Key Created Response
schema:
type: object
properties:
key:
type: string
status:
type: string
enum:
- ok
- error
action:
type: string
enum:
- create
/tyk/keys/{keyId}:
put:
description: |
Update an *API token* with the *session object* defined in the body, this operatin overwrites the existing object
parameters:
-
name: x-tyk-authorization
in: header
description: tyk gateway shared secret
required: true
type: string
format: string
- name: keyId
in: path
type: string
description: Access Token
required: true
-
name: suppress_reset
in: query
description: Adding the `suppress_reset` parameter and setting it to `1`, will cause Tyk to not reset the quota limit that is in the current live quota manager. By default Tyk will reset the quota in the live quota manager (initialising it) when ADDing a key. Adding the `suppress_reset` flag to the URL parameters will avoid this behaviour.
required: false
type: number
format: integer
-
name: session_object
in: body
schema:
$ref: '#/definitions/SessionObject'
-
name: api_id
in: query
description: Back-end to target
required: true
type: string
format: string
responses:
200:
description: Key Updated Response
schema:
type: object
properties:
key:
type: string
status:
type: string
enum:
- ok
- error
action:
type: string
enum:
- modified
post:
description: |
Add a pre-specified *API token* with the *session object* defined in the body, this operatin creates a custom token that dsoes not use the gateway naming convention for tokens
parameters:
-
name: x-tyk-authorization
in: header
description: tyk gateway shared secret
required: true
type: string
format: string
- name: keyId
in: path
type: string
description: Access Token
required: true
-
name: session_object
in: body
schema:
$ref: '#/definitions/SessionObject'
responses:
200:
description: Key Added Response
schema:
type: object
properties:
key:
type: string
status:
type: string
enum:
- ok
- error
action:
type: string
enum:
- added
delete:
description: |
Remove this *API token* from the gateway, this will completely destroy the token and metadata associated with the token and instantly stop access from being granted
parameters:
-
name: x-tyk-authorization
in: header
description: tyk gateway shared secret
required: true
type: string
format: string
- name: keyId
in: path
type: string
description: Access Token
required: true
-
name: api_id
in: query
description: Back-end to target
required: true
type: string
format: string
responses:
200:
description: Key Deleted Response
schema:
type: object
properties: