1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

海しるAPIを使ってみる

Last updated at Posted at 2021-10-13

海しるのAPI

いまは試用サブスクリプションキーを使う。

とりあえず動く様子を確かめたいので、API一覧を取得してみる。

よくわからないけど「Try it」-> 試用サブスクリプションをペーストして「HTTP」を選択して「send」すれば、API一覧が表示される。
「Ruby」を選択してコードをコピーしてpaizaで実行すれば、API一覧が表示される。

require 'net/http'

uri = URI('https://api.msil.go.jp/apis/v1/')

request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Cache-Control'] = 'no-cache'
request['Ocp-Apim-Subscription-Key'] = '0e83ad5d93214e04abf37c970c32b641'
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body

続き

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?