GOG-API Documentation Release 0.1
Total Page:16
File Type:pdf, Size:1020Kb
GOG-API Documentation Release 0.1 Gabriel Huber Jun 05, 2018 Contents 1 Contents 3 1.1 Authentication..............................................3 1.2 Account Management..........................................5 1.3 Listing.................................................. 21 1.4 Store................................................... 25 1.5 Reviews.................................................. 27 1.6 GOG Connect.............................................. 29 1.7 Galaxy APIs............................................... 30 1.8 Game ID List............................................... 45 2 Links 83 3 Contributors 85 HTTP Routing Table 87 i ii GOG-API Documentation, Release 0.1 Welcome to the unoffical documentation of the APIs used by the GOG website and Galaxy client. It’s a very young project, so don’t be surprised if something is missing. But now get ready for a wild ride into a world where GET and POST don’t mean anything and consistency is a lucky mistake. Contents 1 GOG-API Documentation, Release 0.1 2 Contents CHAPTER 1 Contents 1.1 Authentication 1.1.1 Introduction All GOG APIs support token authorization, similar to OAuth2. The web domains www.gog.com, embed.gog.com and some of the Galaxy domains support session cookies too. They both have to be obtained using the GOG login page, because a CAPTCHA may be required to complete the login process. 1.1.2 Auth-Flow 1. Use an embedded browser like WebKit, Gecko or CEF to send the user to https://auth.gog.com/auth. An add-on in your desktop browser should work as well. The exact details about the parameters of this request are described below. 2. Once the login process is completed, the user should be redirected to https://www.gog.com/on_login_success with a login “code” appended at the end. Use the callbacks of your browser engine to detect it, take the code and use it to request a token. 3. Renew the token when it expires after about an hour. Check the original response for an accurate lifetime. 1.1.3 Authorizing a Request To authorize a request set the Authorization header to Bearer <token>. This has to be done for each call. Example request: GET /library/windows HTTP/1.1 Host: embed.gog.com Authorization: Bearer ,!xpIjnwyncascjBf20yz1n1tu8jo9spxyvy3zlvlL0rfoiiuly2hu5xnfgjysnuyhjqI7cmcatscp3ybgDjeqzwCggttnombuuicn_ ,!t6dbqybzYvpoieqtamaKuxpgclnUlt_q4jf_haj2emwgtrkzdlkhwinu7o93bpxWrbjdxr 3 GOG-API Documentation, Release 0.1 1.1.4 Methods GET /auth Redirects to the login site. Don’t use this directly from your client, it’s not a JSON API, visit it with a web browser instead. Query Parameters • client_id (str) – OAuth2 Client ID. Use 46899977096215655. • redirect_uri (str) – URL where the browser will be redirected after the login has been completed. Use https://embed.gog.com/on_login_success?origin=client • response_type (str) – Use code • layout (str) – Use client2 Example request: GET /auth?client_id=46899977096215655&redirect_uri=https%3A%2F%2Fembed.gog.com ,!%2Fon_login_success%3Forigin%3Dclient&response_type=code&layout=client2 HTTP/1.1 Host: auth.gog.com Example redirect: http://localhost:8000/token? ,!code=oF8OSgZVMFb7a8Y3Dolrz4YPqDUnG7TCTsekYKcWnFNcmWWCJH7XJS3RN9d9NB0slx4FS1kss- ,!llBEXvgkCX8oNTP1u3yYG1p56f35jVZCclrCQMk803k5LmQLKM1Wb7 GET /token Generates a new auth token from a login code or refreshes an old one. Query Parameters • client_id (str) – OAuth2 client ID. Use 46899977096215655 • client_secret (str) – OAuth2 secret. Use 9d85c43b1482497dbbce61f6e4aa173a433796eeae2ca8c5f6129f2dc4de46d9 • grant_type (str)– authorization_code for new logins, refresh_token for refreshs. • code (str)– Only for new logins: Login code you got from the auth redirect. • redirect_uri (str)– Only for new logins: The redirect URL you used in the auth request. • refresh_token (str)– Only for refreshes: The refresh_token you got from an old token. This is a separate entry, not the old access token. Example request: GET /token?client_id=46899977096215655&client_ ,!secret=9d85c43b1482497dbbce61f6e4aa173a433796eeae2ca8c5f6129f2dc4de46d9&grant_ ,!type=authorization_code& ,!code=oF8OSgZVMFb7a8Y3Dolrz4YPqDUnG7TCTsekYKcWnFNcmWWCJH7XJS3RN9d9NB0slx4FS1kss- ,!llBEXvgkCX8oNTP1u3yYG1p56f35jVZCclrCQMk803k5LmQLKM1Wb7&redirect_uri=http%3A%2F ,!%2Flocalhost%3A8000%2Ftoken HTTP/1.1 Host: auth.gog.com Example response: 4 Chapter 1. Contents GOG-API Documentation, Release 0.1 { "expires_in": 3600, "scope":"", "token_type": "bearer", "access_token": ,!"xpIjnwyncascjBf20yz1n1tu8jo9spxyvy3zlvlL0rfoiiuly2hu5xnfgjysnuyhjqI7cmcatscp3ybgDjeqzwCggttnombuuicn_ ,!t6dbqybzYvpoieqtamaKuxpgclnUlt_q4jf_haj2emwgtrkzdlkhwinu7o93bpxWrbjdxr", "user_id": "48628349957132247", "refresh_token": "48il-pjxfpknX0hwtxvBnRgNr-n5JAOTKpczaLEBHW7F65iTchjO46f7I-HAV- ,!Cb", "session_id": "6354900816570477251" } 1.2 Account Management Methods used to manage the user’s account. 1.2.1 User GET /userData.json Information about the logged in user. GET /userData.json HTTP/1.1 Host: embed.gog.com Example response: { "country": "AT", "currencies":[ { "code": "EUR", "symbol":" C" }, { "code": "USD", "symbol": "$" } ], "selectedCurrency":{ "code": "EUR", "symbol":" C" }, "preferredLanguage":{ "code": "en", "name": "English" }, "ratingBrand": "PEGI", "isLoggedIn": true, "checksum":{ "cart": null, "games": "c1fc44f3808bd755560e1b00d34451a1", "wishlist": "fcfd279ac1042f8baf8e659729ab1b89", (continues on next page) 1.2. Account Management 5 GOG-API Documentation, Release 0.1 (continued from previous page) "reviews_votes": null, "games_rating": null }, "updates":{ "messages":0, "pendingFriendRequests":0, "unreadChatMessages":0, "products":0, "forum":0, "total":0 }, "userId": "48628349971017", "username": "Yepoleb", "email": "[email protected]", "personalizedProductPrices": [], "personalizedSeriesPrices": [] } GET /user/set-redirect-url Sets URL to redirect to after login. You shouldn’t need this with a native client which is always logged in. Query Parameters • url – Redirect URL, the only accepted value seems to be checkout Example request: GET /user/set-redirect-url?url=checkout HTTP/1.1 Host: embed.gog.com Example response: No content GET /user/reviewTipsStatus.json Checks if the user has read the tips that pop up before you can write your first review. Example request: GET /user/reviewTipsStatus.json HTTP/1.1 Host: embed.gog.com Example response: { "userId": "48628349971017", "readTips": false } GET /users/info/(int: user_id) Returns the public information about a user. Query Parameters • expand (str) – Additional sections to request. Possible values: friendStatus, wishlistSta- tus, blockedStatus Response JSON Object • friendStatus.status (int)– 6 Chapter 1. Contents GOG-API Documentation, Release 0.1 – ANONYMOUS_USER = 0: No special relationship with this user. – INVITED_USER = 1: You have sent this user a friend request. – INVITED_BY_USER = 2: You have received a friend request from this user. – FRIEND = 3: You are friends with this user. • friendStatus.dateCreated (int) – Timestamp of when a friend request was sent or null. • friendStatus.dateAccepted (int) – Timestamp of when a friend request was ac- cepted or null. • wishlistStatus.sharing (int)– – WISHLIST_PRIVATE = 0 – WISHLIST_PUBLIC = 1 – WISHLIST_FOR_FRIENDS = 2 Example request: GET /users/info/48628349971017?expand=friendStatus,wishlistStatus,blockedStatus ,!HTTP/1.1 Host: embed.gog.com Example response: { "id": "48628349971017", "username": "Yepoleb", "userSince": 1449237763, "avatars":{ "small": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avs.jpg", "small2x": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avs2.jpg", "medium": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avm.jpg", "medium2x": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avm2.jpg", "large": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avl.jpg", "large2x": "https://images.gog.com/ ,!3f9e109ac09308f7d52c607c8571e63d5fb482acca499a83e767dfff7f00d57d_avl2.jpg" }, "friendStatus":{ "id": "48628349971017", "status":0, "dateCreated": null, "dateAccepted": null }, "wishlistStatus":{ "sharing":2, "url": "https://embed.gog.com/u/Yepoleb/wishlist" }, "blockedStatus":{ "blocked": false }, (continues on next page) 1.2. Account Management 7 GOG-API Documentation, Release 0.1 (continued from previous page) "chatStatus":{ "url": "https://embed.gog.com/u/Yepoleb/chat", "isChatRestricted": false } } 1.2.2 Games & Movies GET /user/data/games List of games and movies the account owns. Use GET /account/getFilteredProducts for more than just the IDs. Example request: GET /user/data/games HTTP/1.1 Host: embed.gog.com Example response: { "owned":[ 1207658691, 1207658713, 1207658805, 1207658924, 1207658930, 1207658945, 1207658957, 1929434313, 1949616134, 1432207890, 1444035366, 1444036272, 1443696086 ] } GET /account/gameDetails/(int: game_id).json Returns detailed information about a game. Seems to work with movies as well, but they have their own method. Example request: GET /account/gameDetails/1207658691.json HTTP/1.1 Host: embed.gog.com Example response: { "title": "Unreal Tournament 2004 Editor's Choice Edition", "backgroundImage": "//images-4.gog.com/ ,!ebed1d5546a4fa382d7d36db8aee7f298eac7db3a8dc2f4389120b5b7b3155a9", "cdKey":"", "textInformation":"", "downloads":[ [ (continues on next page) 8 Chapter 1. Contents GOG-API Documentation, Release 0.1 (continued from previous page) "English", {