朱哲樺
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • 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
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ## 東琉線提供 API ### POST_新增訂單 - Request ```json header: { X-API-KEY: <key> } "orderDetails": [ { "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1 // 票種類型  "status": 1 }, { "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 2 // 票種類型  "status": 1 }, { "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1 // 票種類型  "status": 1 }, ] ``` - Request Schema | 屬性名稱 | 型別 | 描述 |是否允許為null| |-------------------|----------|------------------------|---------| | `passengerId` | `string` | 乘客的證件號碼 |是| | `passengerMobile` | `string` | 乘客的手機號碼 |是| | `passengerName` | `string` | 乘客的姓名 |是| | `passengerBirthday` | `string` | 乘客的生日(格式:YYYY-MM-DD) |是| | `departureDate` | `string` | 出發日期(格式:YYYY-MM-DD) |否| | `ticketType` | `number` | 票種類型 1: 來回全票、2: 來回半票 |否| | `status` | 1、2、3、4 | 票卷狀態 |否| - Responce ```json "statusCode": 200, // 200成功、400失敗、401驗證失敗 "message": "string", "contents": { "orderDetails": [ { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", // 重要唯一識別碼,請回存 "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1  "status": 1 }, { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 2  "status": 1 }, { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1  "status": 1 } ] } ``` - Responce Schema | 屬性名稱 | 型別 | 描述 | |-----------------------|------------|--------------------------------| | `statusCode` | `number` | 狀態碼(例如 200 成功、400 失敗、401 驗證失敗) | | `message` | `string` | 回應消息 | | `contents` | `object` | 包含訂單詳細信息的物件 | | `contents.orderDetails` | `array` | 訂單明細列表 | | `orderDetailGid` | `string` | 訂單詳細的唯一識別碼 | | `orderNumber` | `string` | 訂單代碼 | | `passengerId` | `string` | 乘客的證件號碼 | | `passengerMobile` | `string` | 乘客的手機號碼 | | `passengerName` | `string` | 乘客的姓名 | | `passengerBirthday` | `string` | 乘客的生日(格式:YYYY-MM-DD) | | `departureDate` | `string` | 出發日期(格式:YYYY-MM-DD) | | `ticketType` | `number` | 票種類型(整數) | | `status` | 1、2、3、4 | 票卷狀態 | - Fetch Example ```javascript= async function postOrderDetails(orderDetails) { const url = 'YOUR_API_URL'; const apiKey = 'YOUR_API_KEY'; try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-KEY': apiKey }, body: JSON.stringify({ orderDetails }) }); if (!response.ok) { throw new Error('Network response was not ok'); } const data = await response.json(); console.log('Success:', data); } catch (error) { console.error('Error:', error); } } // 使用範例 const orderDetails = [ { "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1 } ]; ``` - 問題記錄 1. header 中除了要帶 X-API-KEY 之外,有沒有需要帶 token? > 只需要代 X-API-KEY 就好,除此之外我們還會檢查 domain name 白名單 3. passengerId 為空時,要帶的值是什麼? > 代 `null` 即可 5. passengerMobile、passengerName 有沒有 Regex 限制? > 因為聯營處需求變來變去,目前都沒限制了 7. 如果要訂 2 全 2 半且只有訂票人資料時,orderDetails 應該怎麼傳? > 考量到你們會有個資不齊的情況,目前個資那四個欄位都改為選填 9. isCollected 為 true 時,會寫入當下取票日期,是指說型別會變成 `[boolean,timestamp()]` 嗎? > 不是,你們只要給我們 boolean 就好,該註解是為了告知此動作會回寫取票時間 ### GET_取得訂單 - Request ```url= // 取得多筆票券資料 [GET] https://{domain name}/api/*/orderList/{startDate}/{endDate} [Example] https://{domain name}/api/*/orderList/2024-01-01/2024-01-01 // 取得指定票券資料 [GET] https://{domain name}/api/*/orderList/{orderDetailGid} [Example] https://{domain name}/api/*/orderList/7afed1e1-3e32-4598-fc5e-08dc1e42c939 ``` - Request Schema | 屬性名稱 | 型別 | 描述 | |-------------------|----------|------------------------| | `orderDetailGid` | `string` | 乘客的唯一 ID(票號) | | `startDate` | `string` | 啟程日期起始 | | `endDate` | `string` | 啟程日期結束 | - Responce ```json "statusCode": 200, // 200成功、400失敗、401驗證失敗 "message": "string", "contents": { "orderDetails": [ { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", // 重要唯一識別碼 "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1  "status": 1 }, { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 2  "status": 1 }, { "orderDetailGid": "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "orderNumber": "0123456789", "passengerId": "A123456789", "passengerMobile": "0912345678", "passengerName": "王小明", "passengerBirthday": "1990-01-01", "departureDate": "2023-06-01", "ticketType": 1  "status": 1 } ] } ``` ### DELETE_取消訂單 - Request ```json "orderDetailGid": [ "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "7afed1e1-3e32-4598-fc5e-08dc1e42c939" ] ``` - Request Schema | 屬性名稱 | 型別 | 描述 | |-------------------|----------|------------------------| | `orderDetailGid` | `string[]` | 乘客的唯一 ID(票號 | - Responce ``` "statusCode": 200, // 200成功、400失敗、401驗證失敗 "message": "string" ``` - Responce Schema | 屬性名稱 | 型別 | 描述 | |-----------------------|------------|--------------------------------| | `statusCode` | `number` | 狀態碼(例如 200 成功、400 失敗、401 驗證失敗) | | `message` | `string` | 回應消息 | - Fetch Example ```javascript= async function postOrderDetailGids(orderDetailGids) { const url = 'YOUR_API_URL'; // 替換成您的 API URL const apiKey = 'YOUR_API_KEY'; // 替換成您的 API 密鑰 try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-KEY': apiKey }, body: JSON.stringify({ orderDetailGid: orderDetailGids }) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('Success:', data); } catch (error) { console.error('Error:', error); } } // 使用範例 const orderDetailGids = [ "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "7afed1e1-3e32-4598-fc5e-08dc1e42c939", "7afed1e1-3e32-4598-fc5e-08dc1e42c939" ]; postOrderDetailGids(orderDetailGids); ``` - 問題記錄 1. header 中是否需要帶 X-API-KEY、token? > 要代 X-API-KEY 3. 取消的權限到哪裡? ex:只能取消未取票 > 目前系統機制是,如果「已經登船」(掃票上船後)不允許退票 5. 是否能多回傳目前有效票數,例如全部有 5 張票,取消 3 張,回傳內容會顯示還剩 2 張有效票。 > 如果你們有回存 `orderDetailGid` 應該針對其 ID 更新取票狀態即可,不用依賴此 API 回傳有效票數;另外也可以從 GET 訂單列表 API 取得狀態 --- ## 星宸數位提供 API ### POST_接收取票通知 - Request ```javascript= header: { AuthToken: <key> } { "orderNumber": "{{orderNumber}}", "orderDetails": [ { "orderDetailGid": "{{orderDetailGid}}", "status": 2 // 1:未取|2:已取|3:登船|4:取消 } ] } ``` - Request Schema | 屬性名稱 | 型別 | 描述 | |-------------------|----------|------------------------| | `orderNumber` | `string` | 訂單編號 | | `orderDetails` | `Array<object>` | 乘客的唯一 ID(票號)、票卷狀態 | - Responce ``` "statusCode": 200, // 200成功、400失敗、401驗證失敗 "message": "string" ``` - Responce Schema | 屬性名稱 | 型別 | 描述 | |-----------------------|------------|--------------------------------| | `statusCode` | `number` | 狀態碼(例如 200 成功、400 失敗、401 驗證失敗) | | `message` | `string` | 回應消息 | - Fetch Example ```javascript= async function postCollectStatus(orderDetailGids) { const url = 'YOUR_API_URL'; // 替換成您的 API URL const apiKey = 'YOUR_API_KEY'; // 替換成您的 API 密鑰 try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'AuthToken': 'token' }, body: JSON.stringify({ orderDetailGid: orderDetailGids }) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('Success:', data); } catch (error) { console.error('Error:', error); } } postCollectStatus(orderDetailGids); ``` - 問題記錄 1. header 中的 AuthToken 為固定值,用於辨識請求來源用,介接時星宸提供。 --- ## 額外問題 - 是否也能提供一支可以取得所有訂單的 GET? > 可以

    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