Your EPS account
Sign in to view secure API documentation, update your account details, log support requests and much more.
Your email or password is incorrect. Please try again or reset your password.
If the issue persists please contact your EPS representative.
Reset your password
Please enter your email address below. We will send password reset instructions to the email associated with your EPS account.
Thank you
An email has been sent to your account email address with further instructions on how to reset your password.
API キーの認証とアクセス
各リクエストで API キーと SHA-512 シグネチャ ハッシュを送信するには、HTTP 認証ヘッダーを使用します。シグネチャー ハッシュは API キー、共有秘密、UNIX タイムスタンプからなります。
認証ヘッダーを作成する
EPS では認証ヘッダーに次のフォーマットを使用する必要があります。先頭に EPS
が必要です。このプレフィックスによって、正しい認証ルールがリクエストに適用されます。
Authorization: EAN APIKey=yourAPIKey,Signature=sha512Hash,timestamp=yourUNIXTimestamp
signature
の値は、API キー + 共有秘密 + UNIX タイムスタンプ (秒) を連結したソルトのない SHA-512 ハッシュです。
timestamp
の値は、signature
を生成するために使用したものと同じ値である必要があります。異なるタイムスタンプを使用した場合、EPS はお使いのシグネチャ ハッシュ値を認証できず、リクエストは拒否されます。
完全な認証ヘッダーの例を次に示します。
Authorization: EAN APIKey=dkc4wrkp7w58wx5v2jxen2kx,Signature=Mgup2Azf,timestamp=1476739212
認証ヘッダーを確認する
テスト リクエストを試行する前に、EPS シグネチャー ジェネレーターでご自身のコードをテストしてください。
注意 : NTP クロック同期
EPS は Network Time Protocol (NTP) を使用して内部サーバー時間を同期します。ご自身のサイトでも NTP を使用している場合は、時刻同期の問題は起きません。最近のほとんどのオペレーティング システムでは、この時刻同期サービスまたは同様のサービスをサポートしています。ご使用のオペレーティング システム資料をご確認ください。ある程度の時間差に対応するため、システムはサーバーのタイムスタンプの前後 5 分までのタイムスタンプを受け付けます。
シグネチャー 生成コードの例
PHP
$apiKey = "abcdefg"; $secret = "1a2bc3"; $timestamp = time(); $authHeader = 'Authorization: EAN APIKey=' . $apiKey . ',Signature=' . hash("sha512", $apiKey.$secret.$timestamp) . ',timestamp=' . time();
JavaScript
var crypto = require('crypto'); var request = require('request'); var apiKey = "123"; var secret="123"; var timestamp = Math.round((new Date().getTime()/1000)); var hash = crypto.createHmac('sha256', apiKey+secret+timestamp).digest('hex'); var authHeaderValue = 'EAN APIKey=' +apiKey+ ',Signature=' + hash + ',timestamp=' + timestamp;
Java
import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.Timestamp; import java.util.Date; String apiKey = "123"; String secret = "123"; Date date= new java.util.Date(); Long timestamp = (date.getTime() / 1000); String signature = null; try { String toBeHashed = apiKey + secret + timestamp; MessageDigest md = MessageDigest.getInstance("SHA-512"); byte[] bytes = md.digest(toBeHashed.getBytes("UTF-8")); StringBuilder sb = new StringBuilder(); for(int i=0; i< bytes.length ;i++){ sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); } signature = sb.toString(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String authHeaderValue = "EAN APIKey=" + apiKey + ",Signature=" + signature + ",timestamp=" + timestamp;
Python
import hashlib import datetime apiKey = "123" secret = "123" timestamp = str(int(time.time())); authHeaderValue = "EAN APIKey=" + apiKey + ",Signature=" + hashlib.sha512(apiKey+secret+timestamp).hexdigest() + ",timestamp=" + timestamp
Ruby
require 'digest' apiKey="123" secret="123" timestamp = Time.now.to_i toBeHashed = "#{apiKey}#{secret}#{timestamp}" signature = Digest::SHA2.new(512).hexdigest(toBeHashed) authHeaderValue = "EAN APIKey=#{apiKey},Signature=#{signature},timestamp=#{timestamp}"
C#
String apiKey = "123"; String secret = "123"; TimeSpan epochTicks = new TimeSpan(new DateTime(1970, 1, 1).Ticks); TimeSpan unixTicks = new TimeSpan(DateTime.UtcNow.Ticks) - epochTicks; double unixTime = (int)unixTicks.TotalSeconds; var toBeHashed = apiKey + secret + unixTime; var bytes = System.Text.Encoding.UTF8.GetBytes(toBeHashed); using (var hash = System.Security.Cryptography.SHA512.Create()) { var hashedInputBytes = hash.ComputeHash(bytes); var hashedInputStringBuilder = new System.Text.StringBuilder(128); foreach (var b in hashedInputBytes) hashedInputStringBuilder.Append(b.ToString("X2")); var signature = hashedInputStringBuilder.ToString(); var authHeaderValue = "EAN APIKey=" + apiKey + ",Signature=" + signature +",timestamp=" + unixTime; }
Perl
use strict; use Crypt::Digest::SHA512 qw(sha512_hex); my $apiKey = '123'; my $secret = '123'; my $timestamp = time; my $sig = sha512_hex($apiKey . $secret . $timestamp); my $authHeaderValue = "EAN APIKey=".$apiKey.",Signature=".$sig.",timestamp=".$timestamp; print $authHeaderValue;
共有秘密を保護する
提供された共有秘密はリクエスト データのセキュリティ上非常に重要で、パスワードと同様に扱う必要があります。一般にアクセス可能なサイトやアプリ コードの値をそのまま使用することは避けてください。EPS Rapid の統合が許可されると、共有秘密と API キーが提供されます。
EPS Home | EPS Portal Login | Expedia Partner Central | Advertise with Expedia | News | Privacy Policy | Cookie Policy
© 2020 Expedia, Inc. All Rights Reserved.