API:Get the contents of a page/zh

透過API檢索頁面內容的主要方法有以下三種：


 * 1) 使用 API（wikitext）以獲取頁面的內容.
 * 2) 使用 API（HTML或wikitext）以獲取頁面的內容.
 * 3) 使用TextExtracts擴展的API以獲取頁面的純文本或有限的HTML摘要.

方法1：使用修訂版API
API可用於以wikitext的形式檢索頁面內容. 這可以透過在 參數中指定頁面標題並將 參數設置為 來完成. 需要更多訊息，請參見.

示例
'GET request以獲取頁面Pet door的wikitext內容.

Method 2: Use the Parse API
The API can be used to retrieve page content in either HTML format (parsed) or Wikitext format (unparsed). This can be done by specifying a page with the  parameter or a revision with the   parameter. To retrieve HTML, set  to. To retrieve Wikitext, set  to.

Example 1
GET request to get parsed HTML content of a page: Pet door

Response
\n\n\n\n\n "   } }

Example 2
GET request to get the original wikitext content of a page: Pet door

Method 3: Use the TextExtracts API
The extension provides an API which allows you to retrieve plain-text or limited HTML extracts of page content. See for additional documentation.

Example
Get request to extract 10 sentences from the page Pet door.

Additional notes
The content extracted directly from Wikipedia can be inserted into any MediaWiki wiki through. The content extracted comes in the form of limited wikitext, omitting leading templates, links to files or pages.