Skip to content

Instantly share code, notes, and snippets.

@fantasywind
Last active August 29, 2015 14:15
Show Gist options
  • Save fantasywind/54fe47ceeb3008a7b412 to your computer and use it in GitHub Desktop.
Save fantasywind/54fe47ceeb3008a7b412 to your computer and use it in GitHub Desktop.
{
"swagger": 2,
"info": {
"title": "天品時光膠囊 API",
"description": "Tianping Time capsule API",
"version": "1.0.0"
},
"host": "tianping.test.rytass.com",
"schemes": [
"http"
],
"basePath": "/v1",
"produces": [
"application/json"
],
"paths": {
"/login": {
"post": {
"summary": "Login",
"description": "Login to get access token for service.",
"parameters": [
{
"name": "account",
"in": "body",
"required": true,
"description": "User Account"
},
{
"name": "password",
"in": "body",
"required": true,
"description": "User Password"
}
],
"tags": [
"Members"
],
"responses": {
"200": {
"description": "Successful Logined",
"schema": {
"$ref": "Login"
}
},
"401": {
"description": "Account and password not matched"
},
"404": {
"description": "Account not found"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/mottos": {
"get": {
"summary": "Mottos list",
"tags": [
"Contents"
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "Motto"
}
}
}
}
},
"/company": {
"get": {
"summary": "Company descriptions",
"tags": [
"Contents"
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "Company"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/products": {
"get": {
"summary": "Product descriptions",
"tags": [
"Contents"
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Product"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/partners": {
"get": {
"summary": "Partners descriptions",
"tags": [
"Contents"
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Partner"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/folders": {
"get": {
"summary": "Folder list",
"tags": [
"Folder"
],
"security": [
{
"name": "api"
}
],
"description": "Get user's folder list",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Folder"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"post": {
"summary": "Add folder",
"tags": [
"Folder"
],
"security": [
{
"name": "api"
}
],
"description": "Add new folder",
"parameters": [
{
"name": "name",
"in": "formData",
"required": true
},
{
"name": "introduction",
"in": "formData",
"required": false
},
{
"name": "banner",
"in": "formData",
"required": true,
"description": "You can upload new banner with binary data or selected build-in banner with string."
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/folders/:id": {
"put": {
"summary": "Edit folder",
"tags": [
"Folder"
],
"security": [
{
"name": "api"
}
],
"description": "Add new folder",
"parameters": [
{
"name": "name",
"in": "formData",
"required": true
},
{
"name": "introduction",
"in": "formData",
"required": false
},
{
"name": "banner",
"in": "formData",
"required": true,
"description": "You can upload new banner with binary data or selected build-in banner with string."
}
],
"responses": {
"204": {
"description": "Success"
},
"404": {
"description": "Folder not found"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"delete": {
"summary": "Video folder delete",
"tags": [
"Folder"
],
"security": [
{
"name": "api"
}
],
"description": "Delete user's folder including videos in this folder.",
"responses": {
"204": {
"description": "Success"
},
"404": {
"description": "Folder not found"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"get": {
"summary": "Resource list in specific folder",
"tags": [
"Video",
"Album"
],
"security": [
{
"name": "api"
}
],
"description": "Get video/album list in a folder",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Video"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/folders/:id/videos": {
"post": {
"summary": "Add video",
"tags": [
"Video"
],
"security": [
{
"name": "api"
}
],
"description": "Add new video",
"parameters": [
{
"name": "name",
"in": "formData",
"required": true
},
{
"name": "video",
"in": "formData",
"required": true
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/albums/:id/photos/:id": {
"delete": {
"summary": "Delete special photo in album",
"tags": [
"Album"
],
"security": [
{
"name": "api"
}
],
"description": "Delete specific photo in album",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/albums/:id": {
"post": {
"summary": "Add photo",
"tags": [
"Album"
],
"security": [
{
"name": "api"
}
],
"parameters": [
{
"name": "name",
"in": "formData",
"required": true
},
{
"name": "photos",
"in": "formData",
"required": true
}
],
"description": "Add new photo to specific album",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"delete": {
"summary": "Delete album",
"tags": [
"Album"
],
"security": [
{
"name": "api"
}
],
"description": "Delete specific album",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/videos/:id": {
"delete": {
"summary": "Delete video",
"tags": [
"Video"
],
"security": [
{
"name": "api"
}
],
"description": "Delete specific video",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/albums/:id/events": {
"get": {
"summary": "Album events",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Get events list of a album",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Event"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"post": {
"summary": "Add event",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Add new event on specific album",
"parameters": [
{
"name": "contacts",
"in": "body",
"required": true,
"description": "Contacts who will receive the album, sending array with contact id."
},
{
"name": "announce_type",
"in": "body",
"required": true,
"description": "enum('condition', 'time')"
},
{
"name": "announce_condition",
"in": "body",
"required": false,
"description": "Description of sending condition. Required if announce_type is 'condition'."
},
{
"name": "announce_time",
"in": "body",
"required": false,
"description": "Sending time. Required if announce_type is 'time'."
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/videos/:id/events": {
"get": {
"summary": "Video events",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Get events list of a video",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"items": {
"$ref": "Event"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"post": {
"summary": "Add event",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Add new event on specific video",
"parameters": [
{
"name": "contacts",
"in": "body",
"required": true,
"description": "Contacts who will receive the video, sending array with contact id."
},
{
"name": "announce_type",
"in": "body",
"required": true,
"description": "enum('condition', 'time')"
},
{
"name": "announce_condition",
"in": "body",
"required": false,
"description": "Description of sending condition. Required if announce_type is 'condition'."
},
{
"name": "announce_time",
"in": "body",
"required": false,
"description": "Sending time. Required if announce_type is 'time'."
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/events/:id": {
"get": {
"summary": "Event Detail",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Get event detail",
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "EventDetail"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"delete": {
"summary": "Delete event",
"tags": [
"Event"
],
"security": [
{
"name": "api"
}
],
"description": "Delete specific event",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/contacts": {
"get": {
"summary": "Get contact list",
"tags": [
"Contact"
],
"description": "Get list of contact",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"$ref": "Contact"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
},
"post": {
"summary": "Add contact",
"tags": [
"Contact"
],
"security": [
{
"name": "api"
}
],
"description": "Add new contact",
"parameters": [
{
"name": "title",
"in": "body",
"required": true
},
{
"name": "name",
"in": "body",
"required": true
},
{
"name": "phone",
"in": "body",
"required": false
},
{
"name": "email",
"in": "body",
"required": false
},
{
"name": "address",
"in": "body",
"required": false
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/contact/:id": {
"delete": {
"summary": "Delete contact",
"tags": [
"Contact"
],
"security": [
{
"name": "api"
}
],
"description": "Delete specific contact",
"responses": {
"204": {
"description": "Success"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/geneaolgy": {
"get": {
"summary": "Get user geneaolgy",
"tags": [
"Utility"
],
"description": "Get user geneaolgy",
"security": [
{
"name": "api"
}
],
"responses": {
"200": {
"description": "Success",
"examples": {
"image/svg+xml": "<svg width=\"400\" height=\"110\"><rect width=\"300\" height=\"100\" style=\"fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)\"></svg>"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/family": {
"get": {
"summary": "Get user family member list",
"tags": [
"Utility"
],
"description": "Get user family member list",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"$ref": "Contact"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
},
"/banners": {
"get": {
"summary": "Get build-in banner list",
"tags": [
"Utility"
],
"description": "Get list of build-in banner list for folder.",
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "array",
"$ref": "Banner"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "Error"
}
}
}
}
}
},
"securityDefinitions": {
"api": {
"description": "API access token",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"definitions": {
"Album": {
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
},
"cover": {
"type": "string"
},
"photos": {
"type": "array"
},
"last_updated_time": {
"type": "datetime"
}
}
},
"Contact": {
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "string"
},
"email": {
"type": "string"
},
"address": {
"type": "string"
},
"last_updated_time": {
"type": "datetime"
}
}
},
"EventDetail": {
"properties": {
"contacts": {
"type": "array",
"description": "Contacts who will receive the video, sending array with contact id."
},
"announce_type": {
"type": "string",
"description": "enum('condition', 'time')"
},
"announce_condition": {
"type": "string",
"description": "Description of sending condition. Required if announce_type is 'condition'."
},
"announce_time": {
"type": "dateTime",
"description": "Sending time. Required if announce_type is 'time'."
}
}
},
"Event": {
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "Event ID"
},
"receivers_count": {
"type": "integer",
"format": "int32"
},
"announce_type": {
"type": "string",
"description": "enum('condition', 'time')"
},
"announce_condition": {
"type": "string",
"description": "Description of sending condition. Required if announce_type is 'condition'."
},
"announce_time": {
"type": "dateTime",
"description": "Sending time. Required if announce_type is 'time'."
},
"last_updated_time": {
"type": "datetime"
}
}
},
"Video": {
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "Video ID"
},
"type": {
"type": "string",
"default": "video",
"enum": [
"video",
"album"
]
},
"snapshot": {
"type": "string",
"description": "Snapshot url of video or album"
},
"url": {
"type": "string",
"description": "Youtube URL"
},
"title": {
"type": "string"
},
"events_count": {
"type": "integer",
"format": "int32"
}
}
},
"Banner": {
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "Banner ID"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"Folder": {
"properties": {
"id": {
"type": "integer",
"format": "int32",
"description": "Folder ID"
},
"title": {
"type": "string"
},
"count": {
"type": "integer",
"format": "int32"
},
"introduction": {
"type": "string"
},
"image": {
"type": "string"
},
"last_updated_time": {
"type": "datetime"
}
}
},
"Login": {
"properties": {
"access_token": {
"type": "string",
"description": "Unique access token for session."
}
}
},
"Motto": {
"properties": {
"date": {
"type": "datetime",
"description": "Display date"
},
"sentence": {
"type": "string",
"description": "Motto sentence"
}
}
},
"Company": {
"properties": {
"title": {
"type": "string",
"desciption": "Company name",
"default": "天品國際股份有限公司"
},
"address": {
"type": "string",
"description": "Company address"
},
"image": {
"type": "string",
"description": "Banner URL"
},
"introduction": {
"type": "string",
"description": "Intro of company"
},
"phone": {
"type": "string",
"description": "Phone for instant call"
}
}
},
"Product": {
"properties": {
"name": {
"type": "string",
"description": "Product name"
},
"category": {
"type": "string",
"description": "Product Category"
},
"photo": {
"type": "string",
"description": "Product Photo"
},
"introduction": {
"type": "string",
"description": "Product Intro"
}
}
},
"Partner": {
"properties": {
"title": {
"type": "string",
"descreiption": "Partner name"
},
"category": {
"type": "string",
"enum": [
"法律",
"保險"
],
"description": "Partner page category"
},
"detail": {
"type": "string",
"description": "Partner detail"
},
"phone": {
"type": "string",
"description": "Partner phone for instant call"
},
"banner": {
"type": "string",
"description": "Partner page banne URL"
}
}
},
"Error": {
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment