JavaScript is required to use Bungie.net

Group Avatar

BungieNetPlatform

"Updates, discussions, and documentation of the BungieNetPlatform API."

Request Join
originally posted in:BungieNetPlatform
3/3/2015 6:09:45 AM
7

How to Read the Manifest (Reference)

So you might have just discovered the Destiny APIs and/or have already spent some time banging your head against the table trying to make sense of the Manifest file. Back when I initially started playing around with it, I was trying to figure this out using comments pulled off of various threads in this Group, and even then, I think I still had to figure out some things on my own using PHP. The manifest can be located at: http://www.bungie.net/platform/Destiny/Manifest/ It will give you something like this: [spoiler]array ( 'version' => '43982.15.02.02.1746-3', 'mobileAssetContentPath' => '/common/destiny_content/sqlite/asset/asset_sql_content_7c23eefeaa0003dbc141793135dae141.content', 'mobileGearAssetDataBases' => array ( 0 => array ( 'version' => 0, 'path' => '/common/destiny_content/sqlite/asset/asset_sql_content_7c23eefeaa0003dbc141793135dae141.content', ), 1 => array ( 'version' => 1, 'path' => '/common/destiny_content/sqlite/asset/asset_sql_content_5eed6e9a4cb8e84eeb081b93acf267c4.content', ), ), 'mobileWorldContentPaths' => array ( 'en' => '/common/destiny_content/sqlite/en/world_sql_content_41764675ffa70c7fca0a6873b77aabeb.content', 'fr' => '/common/destiny_content/sqlite/fr/world_sql_content_5c56a7c5c166383195afdcdaa64f4575.content', 'es' => '/common/destiny_content/sqlite/es/world_sql_content_a784ce4972713d7d2f665749a4727d7b.content', 'de' => '/common/destiny_content/sqlite/de/world_sql_content_f0263aae5495546025628408dbdf2fc0.content', 'it' => '/common/destiny_content/sqlite/it/world_sql_content_1726e5fda614c91686b38b6a5debefb0.content', 'ja' => '/common/destiny_content/sqlite/ja/world_sql_content_554c8560f931fedb73e9454481fb4bd4.content', 'pt-br' => '/common/destiny_content/sqlite/pt-br/world_sql_content_12e4e5a8fd13e8efa699396f80a93740.content', ), )[/spoiler] The main files you will probably want to look at are the "mobileWorldContentPaths" (the other 2 I believe are for getting assets needed to render 3D models). Each of these files are an SQLite database file that has been put into a Zip file. Extracting them in PHP is pretty straightforward (get_url is a function I wrote that basically does a cURL request which includes stuff like cookies and my API key etc, file_get_contents can be used here, but it can be much slower than using cURL): [spoiler]$cacheFilePath = 'cache/'.pathinfo($path, PATHINFO_BASENAME); file_put_contents($cacheFilePath.'.zip', get_url($path)); $zip = new ZipArchive(); if ($zip->open($cacheFilePath.'.zip') === TRUE) { $zip->extractTo($_SERVER['DOCUMENT_ROOT'].'/cache'); $zip->close(); }[/spoiler] Now if you are like me, and don't have an SQLite viewer on hand, you have an SQLite file that you don't know what tables it contains or what columns are in said tables. Basically each table will generally have two columns, "id" or "key" and "json". Most of the time, "id" is not the entry's hash so you can't just query for a given entry like you can the /Manifest/{type}/{hash} API. So instead, we need to extract these SQLite files further into something we can actually look at and be able to access. Note: $dbtype is referring to the section in the manifest the file is from (gear, asset, world). [spoiler]if ($db = new SQLite3($dbfile)) { $result = $db->query("SELECT name FROM sqlite_master WHERE type='table'"); while($row = $result->fetchArray()) { $result2 = $db->query('SELECT * FROM '.$row['name']); $data = array(); while ($col = $result2->fetchArray(true)) { $json = json_decode($col['json'], true); if (isset($col['id'])) { $data[$col['id']] = $json; } else if (isset($col['key'])) { $data[$col['key']] = $json; } else { $data[] = $json; } } if (!file_exists($dbtype)) mkdir($dbtype); file_put_contents($dbtype.'/'.$row['name'].'.json', json_encode($data)); } }[/spoiler] You should now have some json files you can open up and view. When loading these json files, you should load them in so that the {dataType}Hash value becomes the key so you can reference them directly, though not all tables use a hash to identify objects. If anyone has solutions for doing this using other languages/frameworks, feel free to post it below so we can have a consolidated guide in one place.

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

View Entire Topic
  • Know this thread is super old and with Destiny 2 coming out, very few will be interested in this. But for practice I got the manifest working in Node.js. Any comments/critiques are more than welcome! Since formatting isn't preserved here, I just posted a link to the code. [url]https://github.com/lrwong/destiny_testing/blob/master/api_testing/public/javascripts/server/manifest.js[/url]

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

    1 Reply
    You are not allowed to view this content.
    ;
    preload icon
    preload icon
    preload icon