SlideShare a Scribd company logo
那些年⼀起追的
APIDOC
APIDOC 使⽤⼿冊
Ivan Wei
第⼀版

初次使⽤ 3...............................................................
Node.js 設定 3......................................................................................................................
兩個設定檔的相同處 3.........................................................................................................
apidoc.json 參數 4..................................................
參數列表 4............................................................................................................................
範例 4...................................................................................................................................
API ⽂件撰寫 5........................................................
參數列表 5............................................................................................................................
APIDOC 撰寫範例 6.............................................................................................................
初次使⽤
Node.js 設定
兩個地⽅可以放設定資料
1. 在根⽬錄新增「apidoc.json」
2. package.json 新增「apidoc: {}」
設定內容有重覆,系統會以 apidoc.json 為主。
兩個設定檔的相同處


apidoc.json package.json
{
"name": "example",
"version": "0.1.0",
"description": "apiDoc basic example",
"title": "Custom apiDoc browser title",
"url" : "https://api.github.com/v1"
}
{

"name": "example",

"version": "0.1.0",

"description": "apiDoc basic example",

"apidoc": {

"title": "Custom apiDoc browser title",

"url" : "https://api.github.com/v1"

}

}
apidoc.json 參數
參數列表
範例
( )
name String ( "name" )
version String ( "0.0.0" )
description String ( "description" )
title String ( "title" )
url String ( "http://localhost" ) Hostname
sampleUrl String ( "http://api.chocolabs.com" )
Hostname
header
Object ( "title": "This header", "filename":
"header.md" )
Header
footer
Object ( "title": "This header", "filename":
"header.md" )
Footer
order Array ( [“A”, “B”, "C"] )
API name / Group name
"name": "Project-Name",

"version": "3.0.1",

"description": " ",

"apidoc": {

"title": "Demo API Docs",

"url": "https://api.github.com/v1",

"sampleUrl": "http://localhost"

}
API ⽂件撰寫
參數列表
/
O @api API @api {method} path [title]
@apiDescription API @apiDescription text
@apiDefine API @apiUse @apiDefine name [title] [description]
@apiUse @apiDefine @apiUse @apiDefineName
@apiError
API  group
@apiError
group = Error 4XX
@apiError [(group)] [{type}] field
[description]
@apiErrorExample @apiError
@apiErrorExample [{type}] [title]

example
@apiExample
API
curl API
@apiExample [{type}] title example
O @apiGroup API @apiGroup name
@apiHeader Header
@apiHeader [(group)] [{type}]
[field=defaultValue] [description]
@apiHeaderExample @apiHeader
@apiHeaderExample [{type}] [title]

example
@apiIgnore
API
@apiIgnore [hint]
O @apiName API @apiName name
@apiParam API
@apiParam [(group)] [{type}]
[field=defaultValue] [description]
@apiParamExample @apiParam
@apiParamExample [{type}] [title]

example
@apiSampleRequest API @apiSampleRequest url
@apiSuccess
API group
@apiSuccess
group = Success 200
@apiSuccess [(group)] [{type}] field
[description]
@apiSuccessExample @apiSuccess
@apiSuccessExample [{type}] {title}

example
@apiPermission API @apiPermission name
1. @apiDefine API
2. API O
3.
APIDOC 撰寫範例
@apiVersion API @apiVersion version
/
/**

* @apiDefine demoDefine

* @apiDescription This is a demo.

*/

/**

* @apiUse demoDefine → @apiDefine demoDefine 

* @api {get} /info/:Id

* @apiVersion 0.0.1

* @apiName info

* @apiGroup Demo

*

* @apiParam {String} UUID

*

* @apiError (403) {json} DemoError

* @apiErrorExample DemoError:

* HTTP/1.1 403 Forbidden

* {

* "message": “Failed.”

* }

*

* @apiSuccessExample Success:

* HTTP/1.1 200 OK

* {

* "info" : {...},

* "total" : "",

* }

*

* @apiSuccessExample Success:

* HTTP/1.1 200 OK

* {

* "info": {...},

* "total": "",

* "current": ""

* }

*/

More Related Content

PDF
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
PDF
Cassandra Day SV 2014: Basic Operations with Apache Cassandra
PDF
Claas medion 310 combines service repair manual
PDF
IBM Flex System Interoperability Guide
PDF
Dgs3612 g cli_dna
PDF
Immutable, and More
PDF
Loadcell troubleshooting
PDF
Intermediate Git
Porting Valgrind to NetBSD and OpenBSD by Masao Uebayashi
Cassandra Day SV 2014: Basic Operations with Apache Cassandra
Claas medion 310 combines service repair manual
IBM Flex System Interoperability Guide
Dgs3612 g cli_dna
Immutable, and More
Loadcell troubleshooting
Intermediate Git

What's hot (8)

PDF
强烈推荐Ann77+python
PDF
Circuitikzmanual
PDF
Deploying IBM Flex System into a Cisco Network
PDF
World super ws v series dienhathe.org
PDF
NVIDIA Tesla V100 GPU Architecture Whitepaper : NOTES
PDF
Tortoise svn 1.8.1-en
PDF
Arduino: Realice proyectos básicos de Arduino 26 experimentos con microcontro...
PDF
Mitsubishi low voltage mccb and elcb world super v series (ws-v series) dienh...
强烈推荐Ann77+python
Circuitikzmanual
Deploying IBM Flex System into a Cisco Network
World super ws v series dienhathe.org
NVIDIA Tesla V100 GPU Architecture Whitepaper : NOTES
Tortoise svn 1.8.1-en
Arduino: Realice proyectos básicos de Arduino 26 experimentos con microcontro...
Mitsubishi low voltage mccb and elcb world super v series (ws-v series) dienh...
Ad

Viewers also liked (20)

PDF
初探行为驱动开发(Bdd)
DOC
測試流程整體介紹
PDF
測試是什麼
PDF
認試軟體測試的世界 & TDD/BDD 入門
PDF
關於測試,我說的其實是......
PDF
anjan resume
PPTX
בלדה לעוזב קיבוץ: מחדר האוכל המשותף לתרבות האקזיט
PPTX
Selfish Accessibility: WordCamp Buffalo 2014
PDF
Startin Web Analytics By GA ver03
DOC
這一打‧好貴
PPT
Маркетинг 2015 - основни правила за малкия и среден бизнес
PPT
Hitler
PDF
Lucy redes sociales myspace
PPTX
Kaunas pristato novatorišką programą „Iniciatyvos Kaunui“
PDF
How to attract and retain Gen Z?
PPT
面向生产环境的SOA系统设计 by 程立
PPT
Presentation 1112 for blog 2
PPS
Ave Mariad[1]..
DOCX
Gp rrr
PDF
Bluehost vs Godaddy Infographic
初探行为驱动开发(Bdd)
測試流程整體介紹
測試是什麼
認試軟體測試的世界 & TDD/BDD 入門
關於測試,我說的其實是......
anjan resume
בלדה לעוזב קיבוץ: מחדר האוכל המשותף לתרבות האקזיט
Selfish Accessibility: WordCamp Buffalo 2014
Startin Web Analytics By GA ver03
這一打‧好貴
Маркетинг 2015 - основни правила за малкия и среден бизнес
Hitler
Lucy redes sociales myspace
Kaunas pristato novatorišką programą „Iniciatyvos Kaunui“
How to attract and retain Gen Z?
面向生产环境的SOA系统设计 by 程立
Presentation 1112 for blog 2
Ave Mariad[1]..
Gp rrr
Bluehost vs Godaddy Infographic
Ad

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
medical staffing services at VALiNTRY
PDF
System and Network Administraation Chapter 3
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administration Chapter 2
PPTX
history of c programming in notes for students .pptx
PDF
Cost to Outsource Software Development in 2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
assetexplorer- product-overview - presentation
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
medical staffing services at VALiNTRY
System and Network Administraation Chapter 3
Digital Strategies for Manufacturing Companies
System and Network Administration Chapter 2
history of c programming in notes for students .pptx
Cost to Outsource Software Development in 2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Navsoft: AI-Powered Business Solutions & Custom Software Development
assetexplorer- product-overview - presentation
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Why Generative AI is the Future of Content, Code & Creativity?
Softaken Excel to vCard Converter Software.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Odoo POS Development Services by CandidRoot Solutions
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
top salesforce developer skills in 2025.pdf
Designing Intelligence for the Shop Floor.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025

apidoc guide with nodejs

  • 2. 初次使⽤ 3............................................................... Node.js 設定 3...................................................................................................................... 兩個設定檔的相同處 3......................................................................................................... apidoc.json 參數 4.................................................. 參數列表 4............................................................................................................................ 範例 4................................................................................................................................... API ⽂件撰寫 5........................................................ 參數列表 5............................................................................................................................ APIDOC 撰寫範例 6.............................................................................................................
  • 3. 初次使⽤ Node.js 設定 兩個地⽅可以放設定資料 1. 在根⽬錄新增「apidoc.json」 2. package.json 新增「apidoc: {}」 設定內容有重覆,系統會以 apidoc.json 為主。 兩個設定檔的相同處 
 apidoc.json package.json { "name": "example", "version": "0.1.0", "description": "apiDoc basic example", "title": "Custom apiDoc browser title", "url" : "https://api.github.com/v1" } { "name": "example", "version": "0.1.0", "description": "apiDoc basic example", "apidoc": { "title": "Custom apiDoc browser title", "url" : "https://api.github.com/v1" } }
  • 4. apidoc.json 參數 參數列表 範例 ( ) name String ( "name" ) version String ( "0.0.0" ) description String ( "description" ) title String ( "title" ) url String ( "http://localhost" ) Hostname sampleUrl String ( "http://api.chocolabs.com" ) Hostname header Object ( "title": "This header", "filename": "header.md" ) Header footer Object ( "title": "This header", "filename": "header.md" ) Footer order Array ( [“A”, “B”, "C"] ) API name / Group name "name": "Project-Name", "version": "3.0.1", "description": " ", "apidoc": { "title": "Demo API Docs", "url": "https://api.github.com/v1", "sampleUrl": "http://localhost" }
  • 5. API ⽂件撰寫 參數列表 / O @api API @api {method} path [title] @apiDescription API @apiDescription text @apiDefine API @apiUse @apiDefine name [title] [description] @apiUse @apiDefine @apiUse @apiDefineName @apiError API  group @apiError group = Error 4XX @apiError [(group)] [{type}] field [description] @apiErrorExample @apiError @apiErrorExample [{type}] [title] example @apiExample API curl API @apiExample [{type}] title example O @apiGroup API @apiGroup name @apiHeader Header @apiHeader [(group)] [{type}] [field=defaultValue] [description] @apiHeaderExample @apiHeader @apiHeaderExample [{type}] [title] example @apiIgnore API @apiIgnore [hint] O @apiName API @apiName name @apiParam API @apiParam [(group)] [{type}] [field=defaultValue] [description] @apiParamExample @apiParam @apiParamExample [{type}] [title] example @apiSampleRequest API @apiSampleRequest url @apiSuccess API group @apiSuccess group = Success 200 @apiSuccess [(group)] [{type}] field [description] @apiSuccessExample @apiSuccess @apiSuccessExample [{type}] {title} example @apiPermission API @apiPermission name
  • 6. 1. @apiDefine API 2. API O 3. APIDOC 撰寫範例 @apiVersion API @apiVersion version / /** * @apiDefine demoDefine * @apiDescription This is a demo. */ /** * @apiUse demoDefine → @apiDefine demoDefine * @api {get} /info/:Id * @apiVersion 0.0.1 * @apiName info * @apiGroup Demo * * @apiParam {String} UUID * * @apiError (403) {json} DemoError * @apiErrorExample DemoError: * HTTP/1.1 403 Forbidden * { * "message": “Failed.” * } * * @apiSuccessExample Success: * HTTP/1.1 200 OK * { * "info" : {...}, * "total" : "", * } * * @apiSuccessExample Success: * HTTP/1.1 200 OK * { * "info": {...}, * "total": "", * "current": "" * } */