I need to save some Apex classes through API in java and this question confused me:
In documentation for the Tooling API I found an example how to update Apex class using MetadataContainer. This example includes a lot of lines of code and about three API calls to server.
Then I found out that I can easily update an apex class using compileClasses or compileAndTest call in Apex API. And this way is much more comfortable for me for many reasons:
1) I need only one API call
2) There is much fewer code
3) I DON'T need to know an Id of an Apex class
4) With this call I can send many classes without knowing if they already exist or not, and everything will be done well : new classes will be created and existing classes will be updated.
So is there any reason why I should use Tooling API and MetadataContainer for that purpose instead of using Apex API and compileClasses?
And by the way - the same question about create call in Soap API. Can I just always use Apex API for all this purposes?
Or there are some details which I don't know/understand or any side effects in using Apex API for such purposes?
I'm using developer edition. Is it possible that in production edition or in sandbox it will work other way?