Documentazione di Steamworks
Codici di errore e risposte

Formati di risposta

Ogni metodo dell'API web di Steamworks è in grado di restituire risposte in molteplici formati. Per impostazione predefinita, tutte le risposte sono restituite con il formato di codifica JSON, ma ogni richiesta può contenere opzionalmente un parametro format che specifica uno dei seguenti formati di risposta.

Esempio:
http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=440&count=1&format=xml

I seguenti valori possono essere passati per questo parametro:
  • JSON

    • L'API restituisce sempre un oggetto contenente l'oggetto nominato e i dati del risultato.
    • Le matrici sono rappresentate come una matrice con il nome del tipo di oggetto in essa contenuta.
    • Null è rappresentato come un null JSON.
    • I numeri a 64 bit sono restituiti come stringhe.
    • Esempio:
      { "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. Ammira i leggendari giocatori <a href=/"https://www.youtube.com/user/stabbyvideo/" target=\"_blank\">Stabby</a> e <a href=/"https://www.youtube.com/user/danethebrain/" target=\"_blank\">Uncle Dane</a> sfidarsi per rispondere all'annosa domanda: chi è il migliore? Spie o ingegneri? Vieni a vederli chiudere la questione una volta per tutte con il nuovo formato competitivo di TF2 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

    • Gli attributi XML non sono utilizzati.
    • Le matrici sono rappresentate come una serie di sottoelementi nell'elemento contenitore del tipo di matrice.
    • Null è rappresentanto dalla parola "null" inclusa tra le tag dell'elemento.
    • Esempio::
      <?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. Ammira i leggendari giocatori <a href="https://www.youtube.com/user/stabbyvideo" target="_blank">Stabby</a> e <a href="https://www.youtube.com/user/danethebrain" target="_blank">Uncle Dane</a> sfidarsi per rispondere all'annosa domanda: chi è il migliore? Spie o ingegneri? Vieni a vederli chiudere la questione una volta per tutte con il nuovo formato competitivo di TF2 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)

    • Questo è il formato dati interno di Valve, utilizzato nei giochi basati sul Source Engine. Getschema, in TF2, restituisce dati simili a "items/items_game.txt", anche se le qualità non vengono espanse in oggetti con il campo "value".
    • Per ulteriori letture, fai riferimento alla wiki della Comunità degli sviluppatori di Valve e alla wiki ufficiale di Team Fortress 2.
    • Le matrici nei dati sono rappresentate come una matrice VDF con il nome dei tipi di oggetto in essa contenuti. La matrice VDF è un oggetto in cui ogni entrata presenta un prefisso contenente il suo codice numerico in una stringa tra virgolette.
    • Null è rappresentato da una stringa vuota.
    • Esempio::
      "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. Ammira i leggendari giocatori <a href=/"https://www.youtube.com/user/stabbyvideo/" target=\"_blank\">Stabby</a> e <a href=/"https://www.youtube.com/user/danethebrain/" target=\"_blank\">Uncle Dane</a> sfidarsi per rispondere all'annosa domanda: chi è il migliore? Spie o ingegneri? Vieni a vederli chiudere la questione una volta per tutte con il nuovo formato competitivo di TF2 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" }

Per analizzare i risultati dell'API web è consigliabile usare una soluzione flessibile, dato che ciascun metodo può restituire risultati in un ordine arbitrario.

Codici di stato HTTP

Quando possibile, l'API web di Steamworks cerca di restituire gli opportuni codici di stato HTTP.

Alcuni dei più comuni sono:
CodiceTestoDescrizione
200OKSuccesso!
400Bad request (richiesta non valida)Verifica che tutti i parametri richiesti siano stati inviati.
401Unauthorized (non autorizzato)Accesso negato. Riprovare non avrà alcun effetto. Verifica il tuo parametro key=.
403Forbidden (proibito)Accesso negato. Riprovare non avrà alcun effetto. Verifica il tuo parametro key=.
404Not found (non trovato)L'API richiesta non esiste.
405Method not allowed (metodo non consentito)Questa API è stata chiamata con il metodo HTTP sbagliato (ad esempio GET o PUSH).
429Too many requests (troppe richieste)La tua frequenza sta venendo limitata.
500Internal Server Error (errore interno del server)Errore non risolvibile, riprova. Se il problema persiste, scrivi nelle discussioni degli sviluppatori di Steamworks con dettagli aggiuntivi riguardo la tua richiesta.
503Service Unavailable (servizio non disponibile)Il servizio è temporaneamente non disponibile o ci sono troppe richieste per rispondere in questo momento. Attendi e riprova più tardi.