Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save s-show/c71b6520c967b02a477e7d5f4b36e2d9 to your computer and use it in GitHub Desktop.
Save s-show/c71b6520c967b02a477e7d5f4b36e2d9 to your computer and use it in GitHub Desktop.

https://api.qmk.fm/v1/keyboards にアクセスするとキーボードのリストが返ってくる。

// コード例
fetch('https://api.qmk.fm/v1/keyboards')
  .then(response => {
    if (!response.ok) {
      throw new Error('Response not success.');
    }
      return response.text();
    }) 
    .then(data => {
      // `data` は CSV なので `split(',')` で配列に変換。
      const keyboardList = data.split(',');
      console.log(keyboardList);
    })
    .catch(error => console.error('There has been a problem with your fetch operation:', error));

> ["["0_sixty"", ""10bleoledhub"", ""1upkeyboards/1up60hse"", ""1upkeyboards/1up60hte"", ...

コード例2

curl https://api.qmk.fm/v1/keyboards | jq

[
  "0_sixty",
  "0_sixty/underglow",
  ...
  "zvecr/zv48/f401",
  "zvecr/zv48/f411"
]

参考情報

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment