What's the Purpose of a Public API and Tradeoffs?
I have been trying to understand the purpose behind why larger companies often make public APIs for external developers to build on top of with their own applications. In the past few years it has almost become a fad that websites make an API to try to establish themselves but even though I see it happening everywhere around me in silicon valley, no one has ever been able to explain to me why exactly this is a good thing.

I can understand for some products (like google maps or yelp) having other developers build on top can allow it to cement the service as the leader in that space because there are so many more applications for it but for other services (like eventful or imbd or last.fm and most others) it seems to me that they are giving away their data -- potentially to competitors -- and getting nothing in return.  Why would these companies want to give away their data in a way which could hurt the number of users which use their service and see their ads?

Is part of the purpose so that there are rules about how to interact with the service to prevent people from crawling in harmful ways? Also I have noticed some companies state that just by using the API you are agreeing to certain usage rules -- so is part of the purpose to control how people will use the data as well?

Don't get me wrong, I love using APIs and I understand the idealistic reasons for building services in such a way that they can grow to be bigger than what one person or company could build, but from a business perspective can anyone explain why you would want to give away your data and computation?
What's the Purpose of a Public API and Tradeoffs?
===

I have been trying to understand the purpose behind why larger companies often make public APIs for external developers to build on top of with their own applications. In the past few years it has almost become a fad that websites make an API to try to establish themselves but even though I see it happening everywhere around me in silicon valley, no one has ever been able to explain to me why exactly this is a good thing.

I can understand for some products (like google maps or yelp) having other developers build on top can allow it to cement the service as the leader in that space because there are so many more applications for it but for other services (like eventful or imbd or last.fm and most others) it seems to me that they are giving away their data -- potentially to competitors -- and getting nothing in return.  Why would these companies want to give away their data in a way which could hurt the number of users which use their service and see their ads?

Is part of the purpose so that there are rules about how to interact with the service to prevent people from crawling in harmful ways? Also I have noticed some companies state that just by using the API you are agreeing to certain usage rules -- so is part of the purpose to control how people will use the data as well?

Don't get me wrong, I love using APIs and I understand the idealistic reasons for building services in such a way that they can grow to be bigger than what one person or company could build, but from a business perspective can anyone explain why you would want to give away your data and computation?