Those companion API functions are deprecated and should no longer be used. Use the actual pet journal API instead.
Code:
local summonedPetGUID = C_PetJournal.GetSummonedPetGUID()
local speciesID, customName, level, xp, maxXp, displayID, isFavorite, name, icon,
petType, creatureID, sourceText, description, isWild, canBattle, tradable, unique,
obtainable = C_PetJournal.GetPetInfoByPetID(summonedPetGUID)
print("Summoned pet:", name, customName)
More info:
http://wowpedia.org/World_of_Warcraf...rnal_Functions