応答形式
Steamworks Web APIの全メソッドは複数の形式での応答をサポートしています。 デフォルトでは、すべての応答は
JSON
にエンコードされて返されます。 しかし、各リクエストはオプションで、次の応答形式の中のひとつを指定した
形式
パラメーターを含むことができます。
例:http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=440&count=1&format=xml
このパラメーターには次の値を渡すことができます。
-
JSON
- APIは常に、指定されたオブジェクトと結果データを含むオブジェクトを返します。
- 配列は、配列内のオブジェクトの型の名前を持つ配列として表されます。
- NULLはJSONのNULLとして表されます。
- 64ビットの数値は文字列として返されます。
- 例:
{
"appnews": {
"appid": 440,
"newsitems": [
{
"gid": "1904306376092568991",
"title": "Prince of Prolander Event ",
"url": "http://store.steampowered.com/news/externalpost/tf2_blog/1904306376092568991",
"is_external_url": true,
"author": "",
"contents": "<a href=/"http://rgl.gg/default.aspx/"><img src=/"https://steamcdn-a.akamaihd.net/steam/news/29555/prince.png?t=1495219023/"></a><br><br>/n<p><b>This Sunday at 4:30pm EST</b> <a href=/"http://rgl.gg/default.aspx/" target=\"_blank\">RGL.gg</a> is hosting their Prince of Prolander event. See legendary players <a href=/"https://www.youtube.com/user/stabbyvideo/" target=\"_blank\">Stabby</a> and <a href=/"https://www.youtube.com/user/danethebrain/" target=\"_blank\">Uncle Dane</a> duke it out to answer the age old question: Who is better? Spies or Engies? Come see them settle the score once and for all in the new competitive TF2 format, Pick/Ban Prolander. Be sure to tune in to <a href=/"https://www.twitch.tv/extvesports/" target=\"_blank\">Twitch</a> this Sunday, and witness this historic event!</p><br>",
"feedlabel": "TF2 Blog",
"date": 1495218420,
"feedname": "tf2_blog",
"feed_type": 0,
"appid": 440
}
],
"count": 2385
}
}
-
XML
- XML属性は使用されません。
- 配列は、配列型の要素を含む一連のサブ要素として表されます。
- NULLは要素のタグ間に"NULL"という単語で表されます。
- 例:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE appnews>
<appnews>
<appid>440</appid>
<newsitems>
<newsitem>
<gid>1904306376092568991</gid>
<title>Prince of Prolander Event </title>
<url>http://store.steampowered.com/news/externalpost/tf2_blog/1904306376092568991</url>
<is_external_url>true</is_external_url>
<author/>
<contents><a href="http://rgl.gg/default.aspx"><img src="https://steamcdn-a.akamaihd.net/steam/news/29555/prince.png?t=1495219023"></a><br><br>
<p><b>This Sunday at 4:30pm EST</b> <a href="http://rgl.gg/default.aspx" target="_blank">RGL.gg</a> is hosting their Prince of Prolander event. See legendary players <a href="https://www.youtube.com/user/stabbyvideo" target="_blank">Stabby</a> and <a href="https://www.youtube.com/user/danethebrain" target="_blank">Uncle Dane</a> duke it out to answer the age old question: Who is better? Spies or Engies? Come see them settle the score once and for all in the new competitive TF2 format, Pick/Ban Prolander. Be sure to tune in to <a href="https://www.twitch.tv/extvesports" target="_blank">Twitch</a> this Sunday, and witness this historic event!</p><br></contents>
<feedlabel>TF2 Blog</feedlabel>
<date>1495218420</date>
<feedname>tf2_blog</feedname>
<feed_type>0</feed_type>
<appid>440</appid>
</newsitem>
</newsitems>
<count>2385</count>
</appnews>
-
VDF(Valve Data Format)
- これは、Source Engineゲームで使用されているValveの内部データ形式です。 TF2のGetSchemaは「items/items_game.txt」に類似したデータを返します(ただし、「値」フィールドを持つオブジェクトに品質は展開されません)。
- ドキュメントは Valve開発者コミュニティウィキ、および Team Fortress 2公式ウィキから利用可能です。
- データ内の配列は、配列内のオブジェクトの型名の VDF 配列として表され、オブジェクトとしてのVDF配列には各項目に、引用符付で囲まれた文字列としての数値キーを伴うプレフィックスを伴います。
- NULLは空の文字列として表されます。
- 例:
"appnews"
{
"appid" "440"
"newsitems"
{
"0"
{
"gid" "1904306376092568991"
"title" "Prince of Prolander Event "
"url" "http://store.steampowered.com/news/externalpost/tf2_blog/1904306376092568991"
"is_external_url" "1"
"author" ""
"contents" "<a href=/"http://rgl.gg/default.aspx/"><img src=/"https://steamcdn-a.akamaihd.net/steam/news/29555/prince.png?t=1495219023/"></a><br><br>
<p><b>This Sunday at 4:30pm EST</b> <a href=/"http://rgl.gg/default.aspx/" target=\"_blank\">RGL.gg</a> is hosting their Prince of Prolander event. See legendary players <a href=/"https://www.youtube.com/user/stabbyvideo/" target=\"_blank\">Stabby</a> and <a href=/"https://www.youtube.com/user/danethebrain/" target=\"_blank\">Uncle Dane</a> duke it out to answer the age old question: Who is better? Spies or Engies? Come see them settle the score once and for all in the new competitive TF2 format, Pick/Ban Prolander. Be sure to tune in to <a href=/"https://www.twitch.tv/extvesports/" target=\"_blank\">Twitch</a> this Sunday, and witness this historic event!</p><br>"
"feedlabel" "TF2 Blog"
"date" "1495218420"
"feedname" "tf2_blog"
"feed_type" "0"
"appid" "440"
}
}
"count" "2385"
}
各メソッドは任意の順序で結果を返す可能性があるため、Web APIの結果を解析するには、柔軟なソリューションを使用する必要があります。
HTTPステータスコード
Steamworks Web APIは、可能な場合、適切なHTTPステータスコードを返そうとします。
以下、一般的なコードです。
コード | テキスト | 説明 |
200 | OK | 成功! |
400 | Bad Request | すべての必要なパラメーターが送信されていることを確認してください。 |
401 | Unauthorized | アクセスが拒否されました。 再試行しても変わりません。 key= パラメーターを確認してください。 |
403 | Forbidden | アクセスが拒否されました。 再試行しても変わりません。 key= パラメーターを確認してください。 |
404 | Not Found | リクエストされたAPIは存在しません。 |
405 | Method Not Allowed | このAPIはGETやPUSHのような誤ったHTTPで呼び出されました。 |
429 | Too Many Requests | レート制限されています。 |
500 | Internal Server Error | 回復不能なエラーが発生しました。もう一度お試しください。 問題が続く場合、リクエストの詳細と合わせてSteamworks開発者掲示板に投稿してください。 |
503 | Service Unavailable | サーバーが一時的に利用できないか、混雑のため応答できません。 しばらく待ってから、もう一度お試しください。 |