Reworked getMedia(), this function is not returning json when success