[BUG] TooltipParams delivering wrong itemlink

#1 - Aug. 13, 2012, 10:57 a.m.
Blizzard Post
There is a bug on itemlinks and the data in tooltipParam.

I get this:
http://eu.battle.net/d3/de/tooltip/item/CMWr9IwGEgcIBBWtxURkHYfEFu8d5OWp8B2VAm2tHTykUAcdbUIXxCILCAAVqv4BABgwIB4wCTiBA0AAUA5ggQM?&format=jsonp

I need this:
http://eu.battle.net/d3/de/tooltip/item-data/CPupgsgLEgcIBBXQ-MgVHRwSc-AdIuzMuB3eJVLLHaaTxPYdiL6-ISILCAEVtUQDABgQIAgwCTijBEAASAtQDmCjBA?classIcon=barbarian&gender=male&format=jsonp

To get the data I do a hero profile request via:
http://eu.battle.net/api/d3/profile/TAG/hero/HEROID

The result has items. Foreach item there is a tooltipParam value. That value is incorrect. It has "item/" but should have "item-data/".

Basically a replace of "item/" to "item-data/".

That delivers the item in JSONP thus I can create a tooltip from it. With the hack it works flawlessly.

*update*
It seems either your servers are currently in the state of updating or the update is missing on some of the servers that handle the request. Because sometimes the request is delivering the correct tooltipParam values and sometimes it just does not.

Testcase:
<?php

//function and variables
function getJsonDataViaCurl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$json = curl_exec($ch);
curl_close ($ch);
return $json;
}

$url = "http://eu.battle.net/api/d3/profile/claedeus-1800/hero/397960";
print $url;

//json data
$json = getJsonDataViaCurl($url);

//gen php array from json code
$hero = json_decode($json, true);

echo '<pre>'.$eol;
foreach($hero['items'] as $key=>$elem) {
print($elem['tooltipParams'])."\n";
}
echo '</pre>'.$eol;

?>
Forum Avatar
Battle.net Developer
#4 - Aug. 13, 2012, 5:32 p.m.
Blizzard Post
We are making the tooltipParams consistent across the API and website, so you won't have to do any string replacement like this.

The intent is that the API and website tooltips ("data-d3tooltip") will all support the "item/<data>" url format.

You caught this during a small transition period, but the revised "item/<data>" urls should begin working on all regions for the website very soon:
http://us.battle.net/d3/en/tooltip/item/CMWr9IwGEgcIBBWtxURkHYfEFu8d5OWp8B2VAm2tHTykUAcdbUIXxCILCAAVqv4BABgwIB4wCTiBA0AAUA5ggQM?&format=jsonp

The "item-data/<data>" tooltip urls will continue to work for the time being, but they may be disabled in the future in favor of the simplified "item/<data>" urls.
Forum Avatar
Battle.net Developer
#6 - Aug. 13, 2012, 6:17 p.m.
Blizzard Post
We are looking at making updates to our tooltip.js script to support these api/profile items, but we don't have any information to share right now.