ガソリン価格 API 開発者ガイド

ガソリンスタンドの詳細

このセクションでは、特定のフューエルステーションに関する詳細情報のリクエストの例を示します。

注 : この例では、HERE API キーを使用して要求を認証します。 使用可能な認証オプションについては 、『 Identity & Access Management 開発者ガイド』を参照してください

ユーザーストーリー

ガソリンスタンドを検索した結果に基づいて、特定のステーションに関する詳細情報を検索したいとします。

リクエストのサマリー

リソース : station/{id}: ここで id 、は fuelStation 一意の値を持つ要素の属性です。 リソースリプレゼンテーションは、拡張子 .xml またはを使用して指定 .jsonします。 詳細について は、「ステーションの詳細」を参照してください。

リクエスト

注意 :id 値は予告なく変更されます。 が id 利用できなくなった場合 404 not found は、ステータスメッセージが返されます。

このコードブロックは、応答データが JSON 形式で配信されるように指定する、完全な要求を示します。


https://fuel-v2.cc.api.here.com/fuel/stations/276u1x0u-749a20a72c684f898d045f54239b962d.json
?apiKey={YOUR_API_KEY}

HERE は、応答データが XML 形式で配信されることを示す同じ要求です。


https://fuel-v2.cc.api.here.com/fuel/stations/276u1x0u-749a20a72c684f898d045f54239b962d.xml
?apiKey={YOUR_API_KEY}

レスポンス

リクエストに対する応答には、次の内容が含まれます。

  • 駅の営業時間
  • ステーションの住所の詳細
  • 燃料価格情報

JSON 形式の応答例を次に示します。


{
   "hasMore":true,
   "fuelStations":{
    "fuelStation":[
     {
      "brand":"Shell",
      "brandIcon":"http://origin.stg.cld.vcdn.data.here.com/p/d/autox_stg/dt/icons/2015-05-06/shell.png",
      "fuelPrice":[
         {
          "price":1.379,
          "fuelType":"27",
          "unit":"l",
          "currency":"EUR",
          "lastUpdateTimestamp":"2015-03-08T14:48:52.000Z"
         },
         {
          "price":1.149,
          "fuelType":"1",
          "unit":"l",
          "currency":"EUR",
          "lastUpdateTimestamp":"2015-03-08T14:48:52.000Z"
         }
      ],
      "stationDetails":{
         "openingHours":{
          "regularOpeningHours":[
           {
            "daymask":127,
            "period":[
               {
                "from":"05:00:00",
                "to":"23:00:00"
               }
            ]
           }
          ]
         }
      },
      "address":{
         "city":"Hamburg",
         "country":"DEU",
         "region":"Hamburg",
         "street":"Alter Teichweg",
         "streetNumber":"71",
         "postalCode":"22049"
      },
      "position":{
         "latitude":53.5845718,
         "longitude":10.0596704
      },
      "name":"Hamburg, Alter Teichweg.",
      "id":"276u1x0u-749a20a72c684f898d045f54239b962d",
      "lastUpdateTimestamp":"2014-12-14T11:05:53.374Z",
      "timeZone":"Europe/Berlin"
     }
    ]
   }
}

XML 形式の応答例を次に示します。


<fuel:fuelStationsResult xmlns:fuel="http://www.here.com/2014/02/ACS-Fuel" xmlns:common="http://www.here.com/2014/02/ACS-Common">
  <hasMore>false</hasMore>
  <fuelStations>
    <fuelStation id="276u1x0u-749a20a72c684f898d045f54239b962d" lastUpdateTimestamp="2014-12-14T11:05:53.374Z" timeZone="Europe/Berlin">
      <address>
        <city>Hamburg</city>
        <country>DEU</country>
        <region>Hamburg</region>
        <street>Alter Teichweg</street>
        <streetNumber>71</streetNumber>
        <postalCode>22049</postalCode>
      </address>
      <position>
        <latitude>53.5845718</latitude>
        <longitude>10.0596704</longitude>
      </position>
      <name>Hamburg, Alter Teichweg.</name>
      <brand>Shell</brand>
      <brandIcon>http://origin.stg.cld.vcdn.data.here.com/p/d/autox_stg/dt/icons/2015-05-06/shell.png</brandIcon>
      <fuelPrice fuelType="27" unit="l" currency="EUR" lastUpdateTimestamp="2015-03-08T14:48:52.000Z">
        <price>1.379</price>
      </fuelPrice>
      <fuelPrice fuelType="1" unit="l" currency="EUR" lastUpdateTimestamp="2015-03-08T14:48:52.000Z">
        <price>1.149</price>
      </fuelPrice>
      <stationDetails>
        <openingHours>
          <regularOpeningHours>
            <daymask>127</daymask>
            <period>
              <from>05:00:00</from>
              <to>23:00:00</to>
            </period>
          </regularOpeningHours>
        </openingHours>
      </stationDetails>
    </fuelStation>
  </fuelStations>
</fuel:fuelStationsResult>

このタイプのリクエストに対するレスポンスの詳細については、「フューエルステーションのレスポンス」を参照してください。