Legal: Yes, diplomats and governments negotiate (quid pro quo) to acquire policies favorable to their countries and their citizens.
Illegal: What the President and his administration were negotiating was to get dirt on a political candidate, not for the American people; but for the President individually as a candidate for President. That is Quid Pro Quo that is illegal, unconstitutional, immoral and probably fatening.