APiGateWay产品tyk restful接口定义

本文档详细介绍了Tyk Gateway API的RESTful接口定义,包括如何使用Tyk Swagger Definitions来理解与操作API网关。通过链接提供的源文件,开发者可以深入学习和配置Tyk Gateway的各种接口功能。
摘要由CSDN通过智能技术生成

源文件: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:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值