###前提・実現したいこと
rubyで、とあるAPIに接続を試みているのですが
"{"success": 0, "error": "signature mismatch"}"となり通りません。
ご教授頂ければと思います。
よろしくお願いします。
###発生している問題・エラーメッセージ
"{"success": 0, "error": "signature mismatch"}"
###該当のソースコード
require 'net/http'
require 'uri'
require 'json'
require "openssl"
require 'time'
require 'CGI'
ZAIF_KEY = "api_key"
ZAIF_SECRET = "secret_api"
uri = URI.parse("https://api.zaif.jp/tapi")
uri.path = "/tapi"
timestamp = Time.now.to_f
method = "get_info"
text = "nonce=#{timestamp}&method=#{method}"
sign = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha512"), ZAIF_SECRET, text)
headers = {'sign' => sign,'key' => ZAIF_KEY }
options = Net::HTTP::Post.new(uri.request_uri, headers)
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
response = https.request(options)
p response.body
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
こちらにAPIの資料があります。
https://corp.zaif.jp/api-docs/trade-api/
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。