六角學院 - HexSchool
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
30
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# TDX API 介接教學全攻略 ## TDX API 用途 平臺**提供涵蓋全國尺度之公車、臺鐵、高鐵、捷運、航空、自行車**等**公共運輸旅運資料服務 API**,歡迎各產政學單位介接使用。 利用本平臺開放資料進行各項應用服務開發時,請考量**不同特性使用者**(如:性別/身心障礙/老幼等)的需求 ## 本次活動 API 介紹 * [API 網址](https://tdx.transportdata.tw/api-service/swagger),分別有觀光、自行車、公車動態 * [PTX API 官方操作教學](https://docs.google.com/viewer?url=https://github.com/ptxmotc/PTX_Web/blob/master/Swagger%E6%9C%8D%E5%8B%99%E8%AA%AA%E6%98%8E%E4%B8%8A%E5%82%B3%E5%8F%83%E8%80%83%E6%AA%94%E6%A1%88/%E5%85%AC%E5%85%B1%E9%81%8B%E8%BC%B8%E6%95%B4%E5%90%88%E8%B3%87%E8%A8%8A%E5%B9%B3%E5%8F%B0%E8%B3%87%E6%96%99%E6%9C%8D%E5%8B%99%E9%96%8B%E7%99%BC%E5%AF%A6%E4%BD%9C.pdf?raw=true) * 以 Google 關鍵字為例 ### 觀光 1. 取得所有觀光景點資料:`/v2/Tourism/ScenicSpot` 2. 取得指定[縣市]觀光景點資料:`/v2/Tourism/ScenicSpot/{City}` > 兩者資料集撈取的景點資料一樣,但後者可以針對縣市來撈取 ### 自行車 1. 取得動態指定[縣市]的公共自行車即時車位資料:`/v2/Bike/Availability/{City}` 2. 取得指定縣市之自行車道路網圖資:`/v2/Cycling/Shape/{City}` 3. 取得指定[位置,範圍]的全臺公共自行車即時車位資料:`/v2/Bike/Availability/NearBy` ### 公車 1. 取得市區所有公車路線:`/v2/Bus/Route/City/{City}` 2. 取得預估到站資料[批次更新]:`/v2/Bus/EstimatedTimeOfArrival/City/{City}/{RouteName}` 3. 取得路線的站序資料(座標):`/v2/Bus/StopOfRoute/City/{City}/{RouteName}` 4. 取得路線資訊(營運業者、車牌號碼、票價):`/v2/Bus/Route/City/{City}/{RouteName}` 5. 取得指定[縣市],[路線名稱]的市區公車路線班表資料:`/v2/Bus/Schedule/City/{City}/{RouteName}` > filter 篩選取得路線名稱為紅56:contains(RouteName/Zh_tw,'紅56A') > https://ptx.transportdata.tw/MOTC/v2/Bus/Route/City/Kaohsiung?$filter=contains(RouteName/Zh_tw,%27%E7%B4%8556A%27)&$format=JSON ### 公車範例 * [雲端公車](https://yunbus.tw/#!main) * [高雄公車動態](https://ibus.tbkc.gov.tw/ibus/driving-map) * [台中即時公車動態資訊](https://citybus.taichung.gov.tw/ebus/driving-map) * [朝陽科大五路線公車動態地圖](https://v.im.cyut.edu.tw/~ckhung/saas/potluckmap/m/cyut-bus/) * [曾漢棋綜合醫院即時資訊顯示看板](http://hbus.nantou.gov.tw/kqoyi/chc.html) ## TDX API 申請 [網址](https://motc-ptx-api-documentation.gitbook.io/motc-ptx-api-documentation/hui-yuan-shen-qing) ### 流程 1. [註冊會員](https://ptx.transportdata.tw/PTX/Management/AccountApply),並選擇一般會員 2. 依照下方欄位填寫,三天後審核成功就會發 Email 信提供 APP ID / KEY ``` 身分類型:加值業者 服務類型:資訊服務業 資料使用用途:程式教學/練習 應用類型:觀光旅遊、網站應用 網址:可先暫填自己的 GitHub 網址或 repo 或 codepen 加值應用、加值應用名稱:加註 「The F2E 活動用」(若能詳述如何應用會更好) 申請服務概述:公車、觀光景點、腳踏車 API等動靜態資料(看要不要說更詳細也可以) ``` Q:被退審核後,該如何重新申請? Q:找不到 APP KEY 該怎麼辦? ## API 帶 header 驗證範例程式碼 * [範例程式碼](https://codepen.io/hexschool/pen/RwgvZEZ?editors=0010) > 不帶 APP ID、KEY 還是可以練習,但會有請求次數限制 ## JS 取值設計 * [範例程式碼](https://codepen.io/hexschool/pen/dyRrMjJ?editors=0010) ## API 介接文章教學 1. [TDX:運輸資料流通服務,以 JS 串接公車等待時間為例](https://noob.tw/tdx-api/) 2. [Postman 如何使用 HMAC 以 TDX API 為例](https://hsiangfeng.github.io/other/20210928/2005731696/?fbclid=IwAR2Lef6bS_rVXxcjbl6Bo2PVXVx7fNJPFKkxkoN_e8ejTq1jdGLZf6IrVvU) --- Q: - curl -

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully