It doesn't matter where you bought it from. It matters that it has the AA flight number. Best to review the basic program rules (such as this) in the FAQ as it will make working in the AAdvantage program a lot easier.
Cheers.
I'm pretty familiar with the policy...all flights with AA numbers earn AAdvantage miles...regardless of where you purchased.