natyosu3
    • 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
      • 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
    • 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 Sharing URL Create Help
Create Create new note Create a note from template
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
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
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
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- title: API設計書 WAGIRI【progateハッカソン】 language_tabs: - shell: Shell - http: HTTP - javascript: JavaScript - ruby: Ruby - python: Python - php: PHP - java: Java - go: Go toc_footers: [] includes: [] search: true code_clipboard: true highlight_theme: darkula headingLevel: 2 generator: "@tarslib/widdershins v4.0.23" --- # API設計書 WAGIRI【progateハッカソン】 Base URLs: * <a href="https://flickgame-api.natyosu.com">本番環境: https://flickgame-api.natyosu.com</a> * <a href="http://localhost:8080">開発環境(ローカル): http://localhost:8080</a> ## GET 単語提供機能API GET /word-get ### 問題を提供するAPI クエリパラメータで難易度と個数を指定することで, 指定した難易度の問題が指定した個数取得できます. ### 仕様 * 仮にeasyの問題数が指定した個数以下しか登録されていない場合は, 登録されている問題全てを返します. * SQL側でランダムで取得しているので, 同じリクエストを送信しても異なる問題を返します. ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |level|query|string| yes |取得したい難易度を指定【easy, normal, hard】| |count|query|integer| yes |取得したい問題数を指定【1-100】| > Response Examples > 適切なリクエストを実行すると, 指定した数の単語情報を格納したリストがレスポンスとして返される. ```json { "data": [ { "word_id": "7", "word_text": "狼", "word_furigana": "オオカミ", "word_level": "normal", "point_allocation": 1 }, { "word_id": "3", "word_text": "鳥", "word_furigana": "トリ", "word_level": "normal", "point_allocation": 1 } ] } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|適切なリクエストを実行すると, 指定した数の単語情報を格納したリストがレスポンスとして返される.|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» data|[object]|true|none||単語情報の配列| |»» word_id|string|true|none||DBに登録されている単語ID| |»» word_text|string|true|none||単語のraw text【漢字, 平仮名】| |»» word_furigana|string|true|none||タイピングで入力する振り仮名| |»» word_level|string|true|none||単語難易度【easy, normal, hard】| |»» point_allocation|integer|true|none||単語に割り当てられている配点| ## POST 新規単語を追加するAPI POST /add-words ### 新規問題を登録するAPI json形式で ```json [ { "word_text": "string", # 問題の表示 ex: 桜吹雪 "word_furigana": "string", # 問題のカタカナ振り仮名 ex: サクラフブキ "word_level": "string", # 問題の難易度 ex: normal "point_allocation": int # 問題に対する配点 ex: 6 } ] ``` 以上のように配列でリクエストを送ることで登録できます. ### 仕様 * 仮に同じword_textの登録を試みると, idは変えずにその他の全てに更新をかけます. ### P.S. 誰でも単語を追加できるのは問題があるので、認証情報を云たらするAPIに余裕があればしたほうが良いかも > Body Parameters ```json [ { "word_text": "狼", "word_furigana": "おおかみ", "word_level": "easy", "point_allocation": 3 }, { "word_text": "鳥", "word_furigana": "とり", "word_level": "easy", "point_allocation": 2 }, { "word_text": "雨にも負けず", "word_furigana": "あめにもまけず", "word_level": "normal", "point_allocation": 7 }, { "word_text": "天は人の上に人を造らず", "word_furigana": "てんはひとのうえにひとをつくらず", "word_level": "hard", "point_allocation": 16 } ] ``` ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |body|body|array[object]| no |none| > Response Examples > 200 Response ```json { "message": "string", "result": "string" } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» message|string|true|none||none| |» result|string|true|none||none| ## POST 得点情報を登録するAPI POST /register-score ### 得点情報を登録するAPI ランキング機能を実装する上でユーザの得点情報が必要なので, ランキング機能APIの前に噛ませるAPIです. ```json { "type": "object", "properties": { "user_id": { "type": [ "string", "null" ], "description": "スコアの登録を行うユーザID.fゲストの場合はnullにしてください" }, "point": { "type": "integer", "description": "取得した点数" }, "level": { "type": "string", "description": "問題の難易度" }, "guest_name": { "type": [ "string", "null" ], "description": "ゲストの表示名. ※ゲストが登録を行う場合に指定" } }, "required": [ "user_id", "point", "level" ] } ``` 上記のJSONをリクエストすることで, 得点情報をDBに登録可能. ### 仕様 * ゲストが得点情報を登録した場合 * guest_nameを指定した場合 nicknameにguiest_nameが設定される.これはランキングに載る際に表示される名前 * guest_nameを送信しなかった場合 全員共通で"名無しさん"というニックネームとして登録される. * ログイン不可能なユーザとしてDBに保存している > Body Parameters ```json { "user_id": "", "point": 280, "level": "normal", "guest_name": "" } ``` ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |body|body|object| no |none| |» user_id|body|string¦null| yes |スコアの登録を行うユーザID.fゲストの場合はnullにしてください| |» point|body|integer| yes |取得した点数| |» level|body|string| yes |問題の難易度| |» guest_name|body|string¦null| no |ゲストの表示名. ※ゲストが登録を行う場合に指定| > Response Examples > 200 Response ```json { "message": "string" } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» message|string|true|none||none| ## GET ランキングを取得するAPI GET /get-ranking ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |level|query|string| no |問題の難易度を指定| |high_order|query|string| no |上位何位まで取得するか| > Response Examples ```json { "level": "normal", "ranking": [ { "user_id": "guest_He67aD8MVY", "nickname": "", "score": 350 }, { "user_id": "guest_fDHVKLZcS1", "nickname": "", "score": 350 } ] } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» level|string|true|none||none| |» ranking|[object]|true|none||none| |»» user_id|string|true|none||none| |»» nickname|string|true|none||none| |»» score|integer|true|none||none| ## GET ルーム作成API GET /room-add ### ルーム作成API リアルタイム対戦を行う際のルーム作成時に叩くAPI リーダーとなる1人が実行する クエリパラメータとして**leader_name**を設定しリクエストを送信するとレスポンスとして以下のようなレスポンスが返ってくる. ```json { "message": "you are leader", "nickname": "都市大バード", "room_id": 86011 } ``` このルームIDを他の参加者に共有して自分のルームに参加してもらう. ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |leader_name|query|string| yes |none| > Response Examples ```json { "message": "you are leader", "nickname": "都市大バード", "room_id": 86011 } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» message|string|true|none||レスポンスメッセージ| |» nickname|string|true|none||リーダーの名前| |» room_id|integer|true|none||サーバでランダムに振られたルームID| ## GET ルーム参加API GET /room-join ### ルーム参加API リアルタイム対戦を行う際のルーム参加時に叩くAPI 参加するメンバがそれぞれ実行する クエリパラメータとして**my_name**と**room_id**を設定しリクエストを送信するとレスポンスとして以下のようなレスポンスが返ってくる. ```json { "message": "you are member", "nickname": "都市大バード", "room_id": 97237 } ``` その後はsocket通信でやり取りを行う. ### Params |Name|Location|Type|Required|Description| |---|---|---|---|---| |my_name|query|string| yes |none| |room_id|query|integer| yes |none| > Response Examples ```json { "message": "you are member", "nickname": "都市大バード", "room_id": 97237 } ``` ### Responses |HTTP Status Code |Meaning|Description|Data schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### Responses Data Schema HTTP Status Code **200** |Name|Type|Required|Restrictions|Title|description| |---|---|---|---|---|---| |» message|string|true|none||レスポンスメッセージ| |» nickname|string|true|none||参加者(自身)のニックネーム| |» room_id|integer|true|none||参加したルームID| # Data Schema <h2 id="tocS_SOCKET_JSON">SOCKET_JSON</h2> <a id="schemasocket_json"></a> <a id="schema_SOCKET_JSON"></a> <a id="tocSsocket_json"></a> <a id="tocssocket_json"></a> ```json { "nickname": "string", "member_type": "string", "room_id": 0 } ``` ### Attribute |Name|Type|Required|Restrictions|Title|Description| |---|---|---|---|---|---| |nickname|string|true|none||ニックネーム| |member_type|string|true|none||リーダかメンバーなのか| |room_id|integer|true|none||ルームID|

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