### Get Game Release Formats using Python Requests Source: https://api-docs.igdb.com/ A Python example using the 'requests' library to fetch game release format data. It demonstrates setting headers and the data payload for a POST request. ```python from requests import post response = post('https://api.igdb.com/v4/game_release_formats', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,created_at,format,updated_at;'}) ``` -------------------------------- ### Example API Request Source: https://api-docs.igdb.com/ This example shows a POST request to the /games endpoint to retrieve information about 10 games. The body specifies the fields to retrieve. ```http POST: https://api.igdb.com/v4/games Client-ID: abcdefg12345 Authorization: Bearer access12345token Body: "fields *;" ``` -------------------------------- ### Get Release Date Statuses (Ruby Net::HTTP) Source: https://api-docs.igdb.com/ This Ruby example shows how to get release date statuses using Net::HTTP. Replace the placeholder values for client ID and authorization token. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/release_date_statuses'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,description,name,updated_at;' puts http.request(request).body ``` -------------------------------- ### Example Response from /dumps Source: https://api-docs.igdb.com/ This is an example of the JSON response you will receive when listing available data dumps. It includes the endpoint, file name, and update timestamp. ```json [ { "endpoint": "games", "file_name": "1234567890_games.csv", "updated_at": 1234567890 } ] ``` -------------------------------- ### Get Platform Version Release Dates (Swift URLSession) Source: https://api-docs.igdb.com/ Example of fetching platform version release dates using Swift's URLSession. This snippet configures the URL request with necessary headers and body. ```swift let url = URL(string: "https://api.igdb.com/v4/platform_version_release_dates")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields category,checksum,created_at,date,date_format,human,m,platform_version,region,release_region,updated_at,y;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Game Release Formats using Swift URLSession Source: https://api-docs.igdb.com/ An example in Swift using URLSession to make a POST request for game release format data. It correctly sets up the URL request, headers, and HTTP body. ```swift let url = URL(string: "https://api.igdb.com/v4/game_release_formats")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,created_at,format,updated_at;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Platforms using Swift URLSession Source: https://api-docs.igdb.com/ This Swift code example shows how to make a POST request to the IGDB platforms endpoint using URLSession. It sets up the request headers and body. ```swift let url = URL(string: "https://api.igdb.com/v4/platforms")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields abbreviation,alternative_name,category,checksum,created_at,generation,name,platform_family,platform_logo,platform_type,slug,summary,updated_at,url,versions,websites;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Platform Version Release Dates (Python Requests) Source: https://api-docs.igdb.com/ Example of fetching platform version release dates using the Python Requests library. This snippet shows how to pass headers and data in the POST request. ```python from requests import post response = post('https://api.igdb.com/v4/platform_version_release_dates', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields category,checksum,created_at,date,date_format,human,m,platform_version,region,release_region,updated_at,y;'}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Get Release Date Statuses (Java Unirest) Source: https://api-docs.igdb.com/ Example of fetching release date statuses using the Unirest library in Java. Remember to substitute your client ID and access token. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/release_date_statuses") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields checksum,created_at,description,name,updated_at;") .asJson(); ``` -------------------------------- ### Get Platform Version Release Dates (Java Unirest) Source: https://api-docs.igdb.com/ Example of fetching platform version release dates using the Unirest library in Java. This snippet shows how to set headers and the request body. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/platform_version_release_dates") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields category,checksum,created_at,date,date_format,human,m,platform_version,region,release_region,updated_at,y;") .asJson(); ``` -------------------------------- ### Get Game Release Formats using Java Unirest Source: https://api-docs.igdb.com/ Example of fetching game release format data using the Unirest library in Java. This code sets the required headers and POST body for the request. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/game_release_formats") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields checksum,created_at,format,updated_at;") .asJson(); ``` -------------------------------- ### Fetch Franchises using Kotlin Http-Client Source: https://api-docs.igdb.com/ Example of making a POST request to the franchises endpoint using Kotlin's http-client. This demonstrates setting headers and the request body. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/franchises".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,created_at,games,name,slug,updated_at,url;").responseString() ``` -------------------------------- ### Get Collection Memberships (Python Requests) Source: https://api-docs.igdb.com/ A Python example using the requests library to get collection memberships. Ensure to fill in your specific Client-ID and Bearer token. ```python from requests import post response = post('https://api.igdb.com/v4/collection_memberships', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,collection,created_at,game,type,updated_at;'}) ``` -------------------------------- ### Fetch Covers using Kotlin Http Source: https://api-docs.igdb.com/ A Kotlin example demonstrating how to fetch cover data using the http-request library. It illustrates setting headers and the request body. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/covers".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields alpha_channel,animated,checksum,game,game_localization,height,image_id,url,width;").responseString() ``` -------------------------------- ### Fetch Websites using Kotlin HTTP Client Source: https://api-docs.igdb.com/ This Kotlin snippet shows how to make a POST request to the websites endpoint using an HTTP client. It demonstrates setting headers and the request body. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/websites".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields category,checksum,game,trusted,type,url;").responseString() ``` -------------------------------- ### Get Collection Memberships (Swift URLSession) Source: https://api-docs.igdb.com/ A Swift example for fetching collection memberships using URLSession. Update the placeholder values for Client-ID and Authorization. ```swift let url = URL(string: "https://api.igdb.com/v4/collection_memberships")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,collection,created_at,game,type,updated_at;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Collection Memberships (Java Unirest) Source: https://api-docs.igdb.com/ Example of retrieving collection memberships using Java with the Unirest library. Remember to substitute your API credentials. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/collection_memberships") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields checksum,collection,created_at,game,type,updated_at;") .asJson(); ``` -------------------------------- ### Get Collection Memberships (JavaScript Fetch) Source: https://api-docs.igdb.com/ This JavaScript example demonstrates fetching collection memberships using the Fetch API. Replace placeholders for credentials. ```javascript fetch( "https://api.igdb.com/v4/collection_memberships", { method: 'POST', headers: { 'Accept': 'application/json', 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', }, body: "fields checksum,collection,created_at,game,type,updated_at;" }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Fetch Franchises using Python Requests Source: https://api-docs.igdb.com/ A Python example using the 'requests' library to make a POST request to the franchises endpoint. It shows how to pass headers and data in the request. ```python from requests import post response = post('https://api.igdb.com/v4/franchises', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,created_at,games,name,slug,updated_at,url;'}) ``` -------------------------------- ### Expanding API Requests for More Data Source: https://api-docs.igdb.com/ To retrieve more than just IDs, expand your request to include specific fields. For example, to get cover art, use 'fields *, cover.*;'. ```text fields *, cover.*; ``` -------------------------------- ### Retrieve Game Screenshots Source: https://api-docs.igdb.com/ This example shows how to query the IGDB API to get the screenshots for a specific game, identified by its ID. It demonstrates the use of the 'fields' and 'where' parameters. ```APIDOC ## GET /games/ ### Description Retrieves the image properties (screenshots) for a specific game. ### Method GET ### Endpoint `https://api.igdb.com/v4/games/` ### Parameters #### Query Parameters - **fields** (string) - Optional - Specifies the fields to retrieve, e.g., `screenshots.*`. - **where** (string) - Required - Filters the results by game ID, e.g., `id = 1942`. ### Request Example ``` fields screenshots.*; where id = 1942; ``` ### Response #### Success Response (200) Returns an array of game objects, each containing an array of screenshot objects with details like `id`, `game`, `height`, `image_id`, `url`, and `width`. #### Response Example ```json [ { "id": 1942, "screenshots": [ { "id": 9742, "game": 1942, "height": 1080, "image_id": "mnljdjtrh44x4snmierh", "url": "//images.igdb.com/igdb/image/upload/t_thumb/mnljdjtrh44x4snmierh.jpg", "width": 1920 } ] } ] ``` ``` -------------------------------- ### Fetch Game Videos using Python Requests Source: https://api-docs.igdb.com/ This Python example uses the 'requests' library to post a request for game video data. It includes setting the request headers and data payload. ```python from requests import post response = post('https://api.igdb.com/v4/game_videos', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,game,name,video_id;'}) ``` -------------------------------- ### Fetch Websites using Java Unirest Source: https://api-docs.igdb.com/ Example of making a POST request to the websites endpoint using the Unirest library in Java. This snippet shows how to set headers and the request body. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/websites") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields category,checksum,game,trusted,type,url;") .asJson(); ``` -------------------------------- ### Get Platform Logos with Java Unirest Source: https://api-docs.igdb.com/ Example of fetching platform logo data using the Java Unirest library. Remember to substitute your client ID and access token. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/platform_logos") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields alpha_channel,animated,checksum,height,image_id,url,width;") .asJson(); ``` -------------------------------- ### Fetch Company Sizes using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby example shows how to make a POST request to the Company Sizes endpoint using the Net::HTTP library. It sets up an SSL connection and custom headers. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/company_sizes'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,name,updated_at;' puts http.request(request).body ``` -------------------------------- ### Fetch Platform Websites using Java Unirest Source: https://api-docs.igdb.com/ Example of making a POST request to the Platform Websites API using the Unirest library in Java. This snippet shows how to set headers and the request body. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/platform_websites") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields category,checksum,trusted,type,url;") .asJson(); ``` -------------------------------- ### Get Release Date Statuses (JavaScript Fetch) Source: https://api-docs.igdb.com/ This JavaScript example demonstrates how to fetch release date statuses using the Fetch API. Replace placeholders for client ID and token. ```javascript fetch( "https://api.igdb.com/v4/release_date_statuses", { method: 'POST', headers: { 'Accept': 'application/json', 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', }, body: "fields checksum,created_at,description,name,updated_at;" }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Create a Report using Swift URLSession Source: https://api-docs.igdb.com/ This Swift example demonstrates creating a report using URLSession. It configures the URLRequest with the correct HTTP method, headers, and body. ```swift let url = URL(string: "https://api.igdb.com/v4/reports")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,created_at,entity_type,report_type,source_item_id,target_item_id,updated_at;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Platform Logos with Swift URLSession Source: https://api-docs.igdb.com/ Example using Swift's URLSession to fetch platform logo data. This code requires valid Client-ID and Authorization Bearer token. ```swift let url = URL(string: "https://api.igdb.com/v4/platform_logos")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields alpha_channel,animated,checksum,height,image_id,url,width;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Fetch Language Support Data with Ruby (Net::HTTP) Source: https://api-docs.igdb.com/ This Ruby example uses the Net::HTTP library to make a POST request to the language_supports endpoint. It demonstrates setting up the HTTP connection, request headers, and the request body. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/language_supports'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,game,language,language_support_type,updated_at;' puts http.request(request).body ``` -------------------------------- ### Get Game Version Feature Values with Java Unirest Source: https://api-docs.igdb.com/ Example of fetching game version feature values using the Unirest library in Java. Remember to substitute your API credentials. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/game_version_feature_values") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields checksum,game,game_feature,included_feature,note;") .asJson(); ``` -------------------------------- ### Fetch Game Modes using Ruby (Net::HTTP) Source: https://api-docs.igdb.com/ This Ruby example shows how to retrieve game mode data using the Net::HTTP library. It sets up an SSL connection, defines the POST request with headers, and sends the body. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/game_modes'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,name,slug,updated_at,url;' puts http.request(request).body ``` -------------------------------- ### Fetch Website Types using Python Requests Source: https://api-docs.igdb.com/ A Python example using the 'requests' library to fetch website types. It demonstrates sending a POST request with custom headers and data. ```python from requests import post response = post('https://api.igdb.com/v4/website_types', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,created_at,type,updated_at;'}) ``` -------------------------------- ### Get Game Time To Beat Data with Kotlin Http-Client Source: https://api-docs.igdb.com/ This Kotlin example utilizes an HTTP client to make a POST request to the game_time_to_beats endpoint. It demonstrates setting headers and the request body. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/game_time_to_beats".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,completely,count,created_at,game_id,hastily,normally,updated_at;").responseString() ``` -------------------------------- ### Fetch Keywords using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby example uses the Net::HTTP library to make a POST request for keyword data. It establishes an SSL connection and sets custom headers. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/keywords'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,name,slug,updated_at,url;' puts http.request(request).body ``` -------------------------------- ### Create a Report using Python Requests Source: https://api-docs.igdb.com/ This Python example uses the 'requests' library to create a report. It demonstrates passing headers and data in the POST request. ```python from requests import post response = post('https://api.igdb.com/v4/reports', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,created_at,entity_type,report_type,source_item_id,target_item_id,updated_at;'}) ``` -------------------------------- ### Fetch Game Videos using Kotlin Http-Client Source: https://api-docs.igdb.com/ An example using Kotlin's http-client to post a request for game video data. It sets headers and the request body for the API call. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/game_videos".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,game,name,video_id;").responseString() ``` -------------------------------- ### Get Game Version Feature Values with Swift URLSession Source: https://api-docs.igdb.com/ Example using Swift's URLSession to retrieve game version feature values. This code sets up the request headers and body for the POST request. ```swift let url = URL(string: "https://api.igdb.com/v4/game_version_feature_values")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,game,game_feature,included_feature,note;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Game Time To Beat Data with JavaScript Fetch API Source: https://api-docs.igdb.com/ This JavaScript example demonstrates how to use the Fetch API to make a POST request to the game_time_to_beats endpoint. It includes error handling for network issues. ```javascript fetch( "https://api.igdb.com/v4/game_time_to_beats", { method: 'POST', headers: { 'Accept': 'application/json', 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', }, body: "fields checksum,completely,count,created_at,game_id,hastily,normally,updated_at;" }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Fetch Covers using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby example uses the Net::HTTP library to make a POST request to the covers endpoint. It demonstrates setting up the HTTP connection and the request details. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/covers'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields alpha_channel,animated,checksum,game,game_localization,height,image_id,url,width;' puts http.request(request).body ``` -------------------------------- ### Fetch Screenshots using Ruby Net::HTTP Source: https://api-docs.igdb.com/ A Ruby example using Net::HTTP to send a POST request for screenshot data. It shows how to establish an SSL connection and set request headers and body. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/screenshots'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields alpha_channel,animated,checksum,game,height,image_id,url,width;' puts http.request(request).body ``` -------------------------------- ### Fetch Game Statuses using Python Requests Source: https://api-docs.igdb.com/ A Python example using the 'requests' library to get game statuses. This snippet shows how to pass headers and data in a POST request and print the JSON response. ```python from requests import post response = post('https://api.igdb.com/v4/game_statuses', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields checksum,created_at,status,updated_at;'}) ``` -------------------------------- ### Fetch Game Version Features (Ruby Net::HTTP) Source: https://api-docs.igdb.com/ A Ruby example using Net::HTTP to make a POST request to the game_version_features API. It shows how to set up an SSL connection and send the request with headers. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/game_version_features'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields category,checksum,description,position,title,values;' puts http.request(request).body ``` -------------------------------- ### Fetch Collection Types using Kotlin HTTP Client Source: https://api-docs.igdb.com/ An example in Kotlin demonstrating how to fetch collection types using an HTTP client. Ensure your API keys are correctly set. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/collection_types".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,created_at,description,name,updated_at;").responseString() ``` -------------------------------- ### Create a Report using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby snippet shows how to create a report using the Net::HTTP library. It establishes an SSL connection and sends the POST request. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/reports'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,created_at,entity_type,report_type,source_item_id,target_item_id,updated_at;' puts http.request(request).body ``` -------------------------------- ### Get Game Time To Beat Data with Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby example uses the Net::HTTP library to make a POST request to the game_time_to_beats endpoint. It sets up an SSL connection and customizes the request headers and body. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/game_time_to_beats'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,completely,count,created_at,game_id,hastily,normally,updated_at;' puts http.request(request).body ``` -------------------------------- ### Fetch Game Modes using Kotlin (Ktor) Source: https://api-docs.igdb.com/ Example of fetching game mode data using Kotlin with Ktor's HTTP client. It shows how to configure headers and the request body for a POST request. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/game_modes".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,created_at,name,slug,updated_at,url;").responseString() ``` -------------------------------- ### Fetch Websites using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby snippet shows how to make a POST request to the websites endpoint using the Net::HTTP library. It sets up SSL and custom headers. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/websites'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields category,checksum,game,trusted,type,url;' puts http.request(request).body ``` -------------------------------- ### Get All Registered Webhooks (Python Requests) Source: https://api-docs.igdb.com/ This Python snippet uses the 'requests' library to get all registered webhooks. It shows how to pass headers for authentication in the GET request. ```python # Get ALL registered Webhooks from requests import post response = get('https://api.igdb.com/v4/webhooks/', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'}}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Fetch Keywords using Kotlin and httpPost Source: https://api-docs.igdb.com/ This Kotlin example utilizes httpPost to fetch keyword data. It configures headers and the request body for the API call. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/keywords".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,created_at,name,slug,updated_at,url;").responseString() ``` -------------------------------- ### Fetch Website Types using Java Unirest Source: https://api-docs.igdb.com/ Example of fetching website types using the Unirest library in Java. This snippet shows how to set headers and send the request. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/website_types") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields checksum,created_at,type,updated_at;") .asJson(); ``` -------------------------------- ### Get All Data Dumps (Swift URLSession) Source: https://api-docs.igdb.com/ Use URLSession in Swift to make a GET request for all available data dumps. Set the Client-ID and Authorization headers. ```swift let url = URL(string: "https://api.igdb.com/v4/dumps")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpMethod = "GET" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Fetch Age Rating Content Descriptions with Python Requests Source: https://api-docs.igdb.com/ This Python example uses the 'requests' library to perform a POST request for age rating content descriptions. It shows how to pass headers and data in the request. ```python from requests import post response = post('https://api.igdb.com/v4/age_rating_content_descriptions', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields category,checksum,description;'}) ``` -------------------------------- ### Get All Data Dumps (JavaScript Fetch) Source: https://api-docs.igdb.com/ Use the Fetch API in JavaScript to get a list of all available data dumps. Include your Client-ID and Authorization token in the headers. ```javascript fetch( "https://api.igdb.com/v4/dumps", { method: 'GET', headers: { 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token' }}) }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Fetch Game Videos using JavaScript Fetch API Source: https://api-docs.igdb.com/ This example demonstrates how to fetch game video data using the JavaScript Fetch API. It includes setting the necessary headers and sending the request body. ```javascript fetch( "https://api.igdb.com/v4/game_videos", { method: 'POST', headers: { 'Accept': 'application/json', 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', }, body: "fields checksum,game,name,video_id;" }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Get Collection Memberships (Kotlin Http) Source: https://api-docs.igdb.com/ This Kotlin snippet shows how to get collection memberships using the http-request library. Ensure your API keys are correctly inserted. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/collection_memberships".httpPost() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token", "Accept" to "application/json") .body("fields checksum,collection,created_at,game,type,updated_at;").responseString() ``` -------------------------------- ### Create Webhook with Python Requests Source: https://api-docs.igdb.com/ A Python example using the 'requests' library to create a webhook. It sends a POST request with headers and data specified as a string. ```python from requests import post response = post('https://api.igdb.com/v4/ENDPOINT/webhooks/', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', 'Content-Type': 'application/x-www-form-urlencoded'}, 'data': 'url=YOUR_WEBHOOK_URL&secret=YOUR_WEBHOOK_SECRET&method=create'}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Get Player Perspectives Source: https://api-docs.igdb.com/ Retrieves a list of player perspectives, allowing filtering by specific fields. This endpoint is used to get information about the different views a player can have in a video game. ```APIDOC ## POST /player_perspectives ### Description Retrieves a list of player perspectives, allowing filtering by specific fields. This endpoint is used to get information about the different views a player can have in a video game. ### Method POST ### Endpoint https://api.igdb.com/v4/player_perspectives ### Parameters #### Query Parameters - **fields** (string) - Optional - Comma-separated list of fields to retrieve. #### Request Body - **fields** (string) - Required - Comma-separated list of fields to retrieve. Example: `checksum,created_at,name,slug,updated_at,url` ### Request Example ```json { "fields": "checksum,created_at,name,slug,updated_at,url;" } ``` ### Response #### Success Response (200) - **checksum** (uuid) - Hash of the object - **created_at** (datetime) - Date this was initially added to the IGDB database - **name** (String) - The name of the player perspective - **slug** (String) - A url-safe, unique, lower-case version of the name - **updated_at** (datetime) - The last date this entry was updated in the IGDB database - **url** (String) - The website address (URL) of the item ### Response Example ```json { "checksum": "string", "created_at": "datetime", "name": "string", "slug": "string", "updated_at": "datetime", "url": "string" } ``` ``` -------------------------------- ### Get Specific Data Dump (Python Requests) Source: https://api-docs.igdb.com/ Use the Python requests library to get the download URL for a specific data dump. Replace ENDPOINT with the desired dump type. ```python from requests import post response = get('https://api.igdb.com/v4/dumps/ENDPOINT', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'}}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Get Specific Data Dump (Kotlin Http) Source: https://api-docs.igdb.com/ Use Kotlin's http-client to get the download URL for a specific data dump. Replace ENDPOINT with the desired dump identifier. ```kotlin val (request, response, result) = "https://api.igdb.com/v4/dumps/ENDPOINT".httpGet() .header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token") .responseString() ``` -------------------------------- ### Fetch Platform Version Companies using Swift URLSession Source: https://api-docs.igdb.com/ This Swift code example shows how to construct and send a POST request to the Platform Version Companies endpoint using URLSession. It configures the request headers and body. ```swift let url = URL(string: "https://api.igdb.com/v4/platform_version_companies")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,comment,company,developer,manufacturer;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get Specific Data Dump (JavaScript Fetch) Source: https://api-docs.igdb.com/ Use the Fetch API in JavaScript to get the download link for a specific data dump. Replace ENDPOINT with the target dump type. ```javascript fetch( "https://api.igdb.com/v4/dumps/ENDPOINT", { method: 'GET', headers: { 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token' }}) }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Get Specific Data Dump (cURL) Source: https://api-docs.igdb.com/ Use this cURL command to get the download link for a specific data dump by replacing ENDPOINT with the desired dump type (e.g., 'games'). ```shell curl -X GET 'https://api.igdb.com/v4/dumps/ENDPOINT' \ -H 'Client-ID: Client ID' \ -H 'Authorization: Bearer access_token' ``` -------------------------------- ### Fetch Companies using Java Unirest Source: https://api-docs.igdb.com/ Example of fetching company data with Java using the Unirest library. Remember to replace placeholders for Client ID and access token. ```java HttpResponse jsonResponse = Unirest.post("https://api.igdb.com/v4/companies") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .header("Accept", "application/json") .body("fields change_date,change_date_category,change_date_format,changed_company_id,checksum,company_size,company_type_histories,country,created_at,description,developed,logo,name,parent,published,slug,start_date,start_date_category,start_date_format,status,updated_at,url,websites;") .asJson(); ``` -------------------------------- ### Fetch Platform Versions using Ruby Net::HTTP Source: https://api-docs.igdb.com/ This Ruby snippet shows how to fetch platform version data using the Net::HTTP library. It establishes an SSL connection and sends a POST request with appropriate headers and body. ```ruby require 'net/https' http = Net::HTTP.new('api.igdb.com/v4',443) http.use_ssl = true request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/platform_versions'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'}) request.body = 'fields checksum,companies,connectivity,cpu,graphics,main_manufacturer,media,memory,name,os,output,platform_logo,platform_version_release_dates,resolutions,slug,sound,storage,summary,url;' puts http.request(request).body ``` -------------------------------- ### Get All Data Dumps (Python Requests) Source: https://api-docs.igdb.com/ Use the Python requests library to get a list of all available data dumps. Pass your Client-ID and Authorization token within the headers dictionary. ```python from requests import post response = get('https://api.igdb.com/v4/dumps', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'}}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Fetch Game Engines using Swift URLSession Source: https://api-docs.igdb.com/ Example using Swift's URLSession to send a POST request for game engine data. This includes setting up the URLRequest with headers and the HTTP body. ```swift let url = URL(string: "https://api.igdb.com/v4/game_engines")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpBody = "fields checksum,companies,created_at,description,logo,name,platforms,slug,updated_at,url;".data(using: .utf8, allowLossyConversion: false) requestHeader.httpMethod = "POST" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") requestHeader.setValue("application/json", forHTTPHeaderField: "Accept") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Get All Registered Webhooks (Java Unirest) Source: https://api-docs.igdb.com/ This Java code uses the Unirest library to make a GET request to retrieve all registered webhooks. It shows how to set request headers for authentication. ```java // Get ALL registered Webhooks HttpResponse jsonResponse = Unirest.get("https://api.igdb.com/v4/webhooks/") .header("Client-ID", "Client ID") .header("Authorization", "Bearer access_token") .asJson(); ``` -------------------------------- ### Fetch Websites using Python Requests Source: https://api-docs.igdb.com/ This Python snippet demonstrates fetching website data using the 'requests' library. It shows how to pass headers and data in the POST request. ```python from requests import post response = post('https://api.igdb.com/v4/websites', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields category,checksum,game,trusted,type,url;'}) ``` -------------------------------- ### Get Platforms using Python Requests Source: https://api-docs.igdb.com/ This Python code uses the 'requests' library to get platform data. It sends a POST request with headers and data, then prints the JSON response. ```python from requests import post response = post('https://api.igdb.com/v4/platforms', **{'headers': {'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token'},'data': 'fields abbreviation,alternative_name,category,checksum,created_at,generation,name,platform_family,platform_logo,platform_type,slug,summary,updated_at,url,versions,websites;.'}) print ("response: %s" % str(response.json())) ``` -------------------------------- ### Fetch Language Support Data with JavaScript (Fetch API) Source: https://api-docs.igdb.com/ This JavaScript example uses the Fetch API to send a POST request to the language_supports endpoint. It includes setting necessary headers and the request body. Error handling for the network request is also included. ```javascript fetch( "https://api.igdb.com/v4/language_supports", { method: 'POST', headers: { 'Accept': 'application/json', 'Client-ID': 'Client ID', 'Authorization': 'Bearer access_token', }, body: "fields checksum,created_at,game,language,language_support_type,updated_at;" }) .then(response => { console.log(response.json()); }) .catch(err => { console.error(err); }); ``` -------------------------------- ### Example AI Assistant Query Source: https://api-docs.igdb.com/ An example natural language query to send to your AI assistant after configuring the MCP Server. If the connection is successful, this will return game results from the IGDB database. ```text "Find me fantasy RPGs with dragons" ``` -------------------------------- ### Get Specific Data Dump (Swift URLSession) Source: https://api-docs.igdb.com/ Use Swift's URLSession to make a GET request for a specific data dump's download link. Remember to replace ENDPOINT with the correct value. ```swift let url = URL(string: "https://api.igdb.com/v4/dumps/ENDPOINT")! var requestHeader = URLRequest.init(url: url as! URL) requestHeader.httpMethod = "GET" requestHeader.setValue("Client ID", forHTTPHeaderField: "Client-ID") requestHeader.setValue("Bearer access_token", forHTTPHeaderField: "Authorization") URLSession.shared.dataTask(with: requestHeader) { data, response, error in }.resume() ``` -------------------------------- ### Create Webhook with Kotlin Http Source: https://api-docs.igdb.com/ This Kotlin snippet shows how to register a webhook using the http-client library. It includes setting up the URL, parameters, and headers for the POST request. ```kotlin val webhookURL = "https://api.igdb.com/v4/ENDPOINT/webhooks/" val webhookParams = listOf("url" to "YOUR_WEBHOOK_URL", "secret" to "YOUR_WEBHOOK_SECRET", "method" to "create") val (request, response, result) = webhookURL.httpPost(webhookParams).header("Client-ID" to "Client ID", "Authorization" to "Bearer access_token").responseString() when (response.statusCode) { 200 -> Logger.info("New webhook registered!") 409 -> Logger.warning("Webhook already exists, already connected.. ") else -> Logger.error("Received unknown error, code: ${response.statusCode}") } ```