Accessing the Helldivers APIs¶
Contents:
The Galactic War in Helldivers 2 is one of the key features of the game, where every mission by every player contributes to an overarching narrative for the game world.
To facilitate this, Arrowhead launched a web based api which returns the current state of the Galactic War as it is now, which many in the community have used to create their own third party applications, such as the Helldivers 2 Companion App.
But before anything else, you need to define a new APIConfig.
APIConfig¶
- pydantic model hd2api.api_config.APIConfig
Primary configuration object used for the API service functions.
Show JSON schema
{ "title": "APIConfig", "description": "Primary configuration object used for the API service functions.", "type": "object", "properties": { "api_comm": { "default": "https://api.helldivers2.dev", "description": "Base path for the community API", "title": "Api Comm", "type": "string" }, "api_diveharder": { "default": "https://api.diveharder.com", "description": "Base path for the Diveharder API", "title": "Api Diveharder", "type": "string" }, "api_direct": { "default": "https://api.live.prod.thehelldiversgame.com", "description": "Base path for the game's API directly", "title": "Api Direct", "type": "string" }, "use_raw": { "default": "direct", "description": "The source to use when calling raw endpoints, default is 'diveharder'", "enum": [ "community", "diveharder", "direct" ], "title": "Use Raw", "type": "string" }, "verify": { "anyOf": [ { "type": "boolean" }, { "type": "string" } ], "default": true, "description": "Unused", "title": "Verify" }, "client_name": { "default": "DefaultClientName", "description": "Name sent to the client", "title": "Client Name", "type": "string" }, "client_contact": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "X-Super-Contact for the community API.", "title": "Client Contact" }, "language": { "default": "en-US", "description": "The accept-language sent to the client", "title": "Language", "type": "string" }, "warID": { "default": 801, "description": "The current warid.", "title": "Warid", "type": "integer" }, "static_path": { "default": "", "description": "Override path for the static json files used by this library's builders", "title": "Static Path", "type": "string" }, "timeout": { "default": 8, "description": "Request timeout value for the endpoints.", "title": "Timeout", "type": "number" }, "statics": { "anyOf": [ { "$ref": "#/$defs/StaticAll" }, { "type": "null" } ], "default": null, "description": "Cached static files" } }, "$defs": { "Biome": { "additionalProperties": true, "description": "Static information about a biome of a planet.", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The fan nickname of the biome.", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The in-game description for the biome.", "title": "Description" } }, "title": "Biome", "type": "object" }, "EffectStatic": { "additionalProperties": true, "description": "Pydantic reprersentation of all the json files pertaining to effects,\ngenerated from statics/effects/planetEffects", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "planetEffects": { "additionalProperties": { "$ref": "#/$defs/KnownPlanetEffect" }, "description": "Dictionary of all known planet effects, where the key is the galacticEffectId", "title": "Planeteffects", "type": "object" } }, "title": "EffectStatic", "type": "object" }, "GalaxyStatic": { "additionalProperties": true, "description": "Pydantic reprersentation of all the json files pertaining to planets,\ngenerated from everything inside statics/planets/**", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "biomes": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Biome" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "fan names and descriptions of all known biomes effects.", "title": "Biomes" }, "environmentals": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Hazard" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Names and descriptions of all known enviornmental effects.", "title": "Environmentals" }, "planets": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/PlanetStatic" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "All static planet data.", "title": "Planets" }, "planetRegion": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/PlanetRegionStatic" }, "type": "object" }, { "type": "null" } ], "description": "All static planet region data.", "title": "Planetregion" } }, "title": "GalaxyStatic", "type": "object" }, "Hazard": { "additionalProperties": true, "description": "Static information about an environmental hazard that can be present on a Planet.", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Official or fan name for environmental hazard", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Official description of the environmental hazard's effects", "title": "Description" } }, "title": "Hazard", "type": "object" }, "KnownPlanetEffect": { "additionalProperties": true, "description": "A known planet effect, with a name and description.", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "galacticEffectId": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The galacticEffectID pertaining to this Effect.", "title": "Galacticeffectid" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A fan nickname for this galactic effect.", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Either the official in game description for this galactic effect,or a fan created description if an official description is not available.", "title": "Description" } }, "title": "KnownPlanetEffect", "type": "object" }, "PlanetRegionStatic": { "additionalProperties": true, "description": "All static data reguarding each region, generated from statics/planets/planetRegion.json", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "English name of the region.", "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The Description for this region.", "title": "Description" }, "region_faction": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Faction that alters what this region is displayed as on the UI.", "title": "Region Faction" }, "region_type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The template used to generate missions for this region.", "title": "Region Type" }, "regions_connected_to": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Regions connected to this one.", "title": "Regions Connected To" } }, "title": "PlanetRegionStatic", "type": "object" }, "PlanetStatic": { "additionalProperties": true, "description": "All static data reguarding each planet, generated from statics/planets/planets.json", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "English name of the planet.", "title": "Name" }, "sector": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the planet's sector.", "title": "Sector" }, "biome": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The 'slug' for the planet's biome.", "title": "Biome" }, "environmentals": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of all enviormental effects on this planet.", "title": "Environmentals" }, "weather_effects": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of all weather based effects on this planet.", "title": "Weather Effects" }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The 'PlanetType' of this planet. This determines terrain layouts.", "title": "Type" }, "names": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "All known localized names for this planet.", "title": "Names" } }, "title": "PlanetStatic", "type": "object" }, "StaticAll": { "additionalProperties": true, "description": "All the static models in one package.", "properties": { "retrieved_at": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Retrieved At" }, "time_delta": { "anyOf": [ { "format": "duration", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time Delta" }, "galaxystatic": { "anyOf": [ { "$ref": "#/$defs/GalaxyStatic" }, { "type": "null" } ], "default": null }, "effectstatic": { "anyOf": [ { "$ref": "#/$defs/EffectStatic" }, { "type": "null" } ], "default": null } }, "title": "StaticAll", "type": "object" } } }
ServiceEndpoints¶
There are 5 important raw endpoints from the game’s api to consider, each returns an import game object.
War Status is the current state of the galactic war .. autofunction:: hd2api.services.async_raw_service.GetApiRawWarStatus
- no-index:
WarInfo is additional infomation on the galactic war’s planets, including their supply lines .. autofunction:: hd2api.services.async_raw_service.GetApiRawWarInfo
- no-index:
WarSummary is the statistics gathered during the galactic war .. autofunction:: hd2api.services.async_raw_service.GetApiRawSummary
- no-index:
Assignment is the major order, if there currently is one. .. autofunction:: hd2api.services.async_raw_service.GetApiRawAssignment
- no-index:
The NewsFeed is the list of dispatches. .. autofunction:: hd2api.services.async_raw_service.GetApiRawNewsFeed
- no-index:
Of course, if you want to get every raw object at once, it’s recommended to use the GetApiRawAll function, which will return everything within a self contained “DiveharderAll” class.
- async hd2api.services.async_raw_service.GetApiRawAll(api_config_override: APIConfig, direct=False) DiveharderAll
Retrieve all raw data from the api, optionally using the direct method.