Skip to content

Instantly share code, notes, and snippets.

@tushroy
Created April 20, 2020 08:05
Show Gist options
  • Save tushroy/efd1cbc455ca18a04b545c33aa09e36b to your computer and use it in GitHub Desktop.
Save tushroy/efd1cbc455ca18a04b545c33aa09e36b to your computer and use it in GitHub Desktop.
sampleapi json
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Customer Details API"
},
"host": "localhost",
"basePath": "/api/v1/custinfo",
"tags": [
{
"name": "Customer",
"description": "Customer Information"
}
],
"schemes": [
"https",
"http"
],
"paths": {
"/{IdType}/{IdNumber}": {
"get": {
"tags": [
"Customer"
],
"summary": "Get customer information",
"description": "Returns a customer information",
"operationId": "getCustomerById",
"produces": [
"application/json"
],
"parameters": [
{
"name": "IdType",
"in": "path",
"description": "either 'NID' or 'CIF'",
"required": true,
"type": "string"
},
{
"name": "IdNumber",
"in": "path",
"description": "NID or CIF as in number",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Response"
}
},
"400": {
"description": "Invalid ID supplied"
}
},
"security": [
{
"api_key": []
}
]
}
}
},
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
}
},
"definitions": {
"CustomerDetails": {
"type": "object",
"required": [
"firstName",
"lastName"
],
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"xml": {
"name": "CustomerDetails"
}
},
"Response": {
"type": "object",
"required": [
"success"
],
"properties": {
"success": {
"type": "boolean"
},
"message": {
"type": "string"
},
"output": {
"$ref": "#/definitions/CustomerDetails"
}
},
"xml": {
"name": "Response"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment