Created
April 19, 2020 05:37
Star
You must be signed in to star a gist
Sample yaml file for Payment API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
description: | | |
API documentation for Sample API. | |
version: "0.0.1" | |
title: "Sample API" | |
host: "payment.swagger.io" | |
basePath: "/v1" | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
tags: | |
- name: "payment" | |
description: "Everything about payments" | |
schemes: | |
- "https" | |
- "http" | |
paths: | |
/payment: | |
get: | |
tags: | |
- "payment" | |
summary: "retrieve payments" | |
description: "Retrieve all payment records as array" | |
responses: | |
200: | |
description: "successful operation" | |
schema: | |
type: "object" | |
properties: | |
errorCode: | |
type: "string" | |
data: | |
type: "array" | |
items: | |
$ref: "#/definitions/Payment" | |
default: | |
$ref: "#/responses/Error" | |
post: | |
tags: | |
- "payment" | |
summary: "create a new payment" | |
description: "Create a new payment record and return its ID" | |
parameters: | |
- in: "body" | |
name: "body" | |
required: true | |
schema: | |
$ref: "#/definitions/PaymentToInsert" | |
responses: | |
200: | |
description: "successful operation" | |
schema: | |
type: "object" | |
properties: | |
data: | |
type: "string" | |
description: "application id" | |
default: | |
$ref: "#/responses/Error" | |
put: | |
tags: | |
- "payment" | |
summary: "update an existing payment" | |
description: "Update a payment record with the details of the request body" | |
parameters: | |
- in: "body" | |
name: "body" | |
required: true | |
schema: | |
$ref: "#/definitions/Payment" | |
responses: | |
200: | |
description: "successful operation" | |
schema: | |
type: "object" | |
properties: | |
data: | |
type: "string" | |
description: "applicaton id" | |
default: | |
$ref: "#/responses/Error" | |
/payment/{id}: | |
get: | |
tags: | |
- "payment" | |
summary: "retrieve a payment record" | |
description: "Retrieve details of a payment record defined by the payment ID" | |
parameters: | |
- name: "id" | |
in: "path" | |
required: true | |
type: "string" | |
responses: | |
200: | |
description: "successful operation" | |
schema: | |
type: "object" | |
properties: | |
data: | |
$ref: "#/definitions/Payment" | |
default: | |
$ref: "#/responses/Error" | |
responses: | |
Error: | |
description: "failed operation" | |
schema: | |
$ref: "#/definitions/ErrResponse" | |
definitions: | |
Payment: | |
description: "ID must be specified if used as an input request body parameter" | |
type: "object" | |
properties: | |
Id: | |
type: "string" | |
Name: | |
type: "string" | |
Amount__c: | |
type: "integer" | |
PaymentToInsert: | |
description: "The ID is not specified" | |
type: "object" | |
properties: | |
Name: | |
type: "string" | |
Amount__c: | |
type: "integer" | |
ErrResponse: | |
type: "array" | |
items: | |
type: "object" | |
properties: | |
errorCode: | |
type: "string" | |
message: | |
type: "string" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment