One should learn from this - NEVER ask an airline if it qualifies for mileage on another airlines' frequent flyer programme!
IBERIA would NOT know which fare qualifies for what on American's programme. As far as they are concerned, K class would qualify for mileage on IBERIA's FF programme.
I doubt AAdvantage would credit mileage on that flight because you had not asked them. If you had, and were given the runaround, they might give you the mileage after all.
I read from these posts about the 'possibility' that Iberia's K class not giving miles on AA as well. I decided to switch to using Qantas' Frequent Fler programme and then called Qantas in Sydney to verify. Yes, they told me, that I would qualify for points even on a K class ticket (though at 70% of the mileage because it was a discounted ticket). AFter 2 weeks, the points were posted on my Qantas Frequent Flyer account.