Skip to content

Instantly share code, notes, and snippets.

@YuukiToriyama
Created September 17, 2019 14:01
Show Gist options
  • Save YuukiToriyama/57b85dcd5337692979d2f1ae53410811 to your computer and use it in GitHub Desktop.
Save YuukiToriyama/57b85dcd5337692979d2f1ae53410811 to your computer and use it in GitHub Desktop.
mioponAPIをシェルから叩く
# .develoer_idにはデベロッパIDを.access_tokenにはアクセストークンをそれぞれ改行なしで入れるものとする
curl -H "X-IIJmio-Developer:$(cat .developer_id)" -H "X-IIJmio-Authorization:$(cat .access_token)" https://api.iijmio.jp/mobile/d/v2/coupon/ > test
@YuukiToriyama
Copy link
Author

更に、

cat test | ruby -r json -ne 'puts JSON.pretty_generate(JSON.parse($_))'

ってやると、

{
  "returnCode": "OK",
  "couponInfo": [
    {
      "hddServiceCode": "hdd00000111",
      "coupon": [
        {
          "volume": 0,
          "expire": "201909",
          "type": "bundle"
        },
        {
          "volume": 1000,
          "expire": "201910",
          "type": "bundle"
        },
        {
          "volume": 0,
          "expire": "201909",
          "type": "topup"
        },
        {
          "volume": 0,
          "expire": "201910",
          "type": "topup"
        },
        {
          "volume": 70,
          "expire": "201911",
          "type": "topup"
        },
        {
          "volume": 0,
          "expire": "201912",
          "type": "topup"
        }
      ],
      "hdoInfo": [
        {
          "couponUse": true,
          "coupon": [
            {
              "volume": 10,
              "expire": null,
              "type": "sim"
            }
          ],
          "hdoServiceCode": "hdo22444222",
          "sms": true,
          "number": "08099998877",
          "regulation": false,
          "iccid": "AX111122223333",
          "voice": true
        },
        {
          "couponUse": false,
          "coupon": [
            {
              "volume": 6,
              "expire": null,
              "type": "sim"
            }
          ],
          "hdoServiceCode": "hdo11112222",
          "sms": true,
          "number": "08001234567",
          "regulation": false,
          "iccid": "AX1111111111111",
          "voice": false
        }
      ],
      "plan": "Minimum Start"
    }
  ]
}

みたいに整形されてでてくる。

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