| # Copyright 2017 Google Inc. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| swagger: "2.0" |
| info: |
| version: "v1" |
| title: APID analytics API |
| host: playground.apistudio.io |
| basePath: /try/64e409ad-aebb-4bbc-977e-f0e0f22209d4 |
| schemes: |
| - http |
| - https |
| consumes: |
| - application/json |
| produces: |
| - application/json |
| paths: |
| '/analytics/{bundle_scope_uuid}': |
| x-swagger-router-controller: analytics |
| parameters: |
| - name: bundle_scope_uuid |
| in: path |
| required: true |
| description: bundle UUID that can be mapped to a scope by APID |
| type: string |
| - name: analytics_data |
| in: body |
| description: The analytics data you want to post |
| required: true |
| schema: |
| $ref: "#/definitions/records" |
| post: |
| responses: |
| "200": |
| description: Success |
| "400": |
| description: Bad Request |
| schema: |
| $ref: "#/definitions/errClientError" |
| "500": |
| description: Server error |
| schema: |
| $ref: "#/definitions/errServerError" |
| default: |
| description: Error |
| schema: |
| $ref: "#/definitions/errResponse" |
| |
| definitions: |
| records: |
| type: object |
| required: |
| - records |
| properties: |
| records: |
| type: array |
| minItems: 1 |
| items: |
| $ref: "#/definitions/eachRecord" |
| example: { |
| "records":[{ |
| "response_status_code": 400, |
| "client_received_start_timestamp": 1462850097576, |
| "client_id":"0GJKn7EQmNkKYcGL7x3gHaawWLs5gUPr" |
| },{ |
| "response_status_code": 200, |
| "client_id":"2ngXgr6Rl2PXWiEmbt8zCkWY3Ptjb8ep", |
| "request_verb" : "GET", |
| "api_product":" test_product", |
| "access_token" : "fewGWG343LDV346345YCDS", |
| "apiproxy" : "OAuthProxy", |
| "apiproxy_revision" : "2", |
| "client_ip": "10.16.9.11", |
| "client_sent_end_timestamp": 1462850097894, |
| "client_received_start_timestamp": 1462850097576, |
| "client_received_end_timestamp": 1462850097580, |
| "client_sent_start_timestamp": 1462850097894, |
| "request_path" : "/oauth/oauthv2/auth_code/", |
| "request_uri": "/oauth/oauthv2/auth_code/?response_type=code&redirect_url=http%3A%2F%2Fexample.com&client_id=A1h6yYAVeADnEKji8M37zCSn6olcmQDB", |
| "useragent" : "Chrome", |
| "target" : "target_name", |
| "target_received_end_timestamp": 1462850097800, |
| "target_received_start_timestamp": 1462850097800, |
| "target_response_code" : 200, |
| "target_sent_end_timestamp" : 1462850097802, |
| "target_sent_start_timestamp" : 1462850097802 |
| }] |
| } |
| |
| eachRecord: |
| description: Each record is basically a map of key value pair. client_received_start_timestamp is a required property but more fields can be added |
| type: object |
| required: |
| - client_received_start_timestamp |
| properties: |
| client_received_start_timestamp: |
| type: integer |
| format: int64 |
| example: { |
| "response_status_code":400, |
| "client_received_start_timestamp":1462850097576, |
| "client_id":"0GJKn7EQmNkKYcGL7x3gHaawWLs5gUPr" |
| } |
| |
| errClientError: |
| required: |
| - errrorCode |
| - reason |
| properties: |
| errrorCode: |
| type: string |
| enum: |
| - UNKNOWN_SCOPE |
| - BAD_DATA |
| - UNSUPPORTED_CONTENT_TYPE |
| - UNSUPPORTED_CONTENT_ENCODING |
| - MISSING_FIELD |
| reason: |
| type: string |
| example: { |
| "errrorCode":"UNKNOWN_SCOPE", |
| "reason":"No tenant found for this scopeuuid : UUID" |
| } |
| |
| errServerError: |
| required: |
| - errrorCode |
| - reason |
| properties: |
| errrorCode: |
| type: string |
| enum: |
| - INTERNAL_SERVER_ERROR |
| - INTERNAL_SEARCH_ERROR |
| reason: |
| type: string |
| example: { |
| "errrorCode":"INTERNAL_SERVER_ERROR", |
| "reason":"Service is not initialized completely" |
| } |
| |
| errResponse: |
| required: |
| - errrorCode |
| - reason |
| properties: |
| errrorCode: |
| type: string |
| reason: |
| type: string |