Is it worth building from the beginning or is it better build an API later on when you actually need it?1 likes
Ask questions and learn from expert freelancers
The question is very good. First of all, you have to be clear about your websites purpose.
If adding an API to your website does not offer any business value, or does not offer any service which people or developers could use, then there is no real sense to create an API, only if you want to do it for fun.
The type of websites which usually do not have an API are company websites, contact websites (like online CV for yourself) or blogs.
The typical webpages which may have APIs are the ones which offer some service, like Google's Search engine, Google translate or Maps. Basically if your website or product is doing some data processing then it does worth creating an API.
Another reason why you could create an API for your business or website is because you want to use the API in mobile or desktop applications built for your business case, or even offer as API as a Service for developers or other companies.
Please keep in mind if you are building an API for your website that it's a new apart of your website which needs to be protected and it may also be subject to cyberattacks.
if you want to build an API that you want to use as a template in you future projects.
you have to fixes your object and needs if want to use a special Programs do it with pure language (PHP,Python,...) , if you want to be more organised use frameworks like(laravel,django...).
you idea must be general if you want to use it in many projects,
API (application program interface) is a set of data, routines, protocols, and tools for building software applications. If your website provides some kind of service, you can build API. But that service must be useful for other software components or service consumers. Unless it would be waste of time and resources.2 likes
The question mostly is not - when to build, but - do you need it? As said above, think about your own needs. API is a service to let some of your users (customers) communicate with your site, or platform. So based on this, decide the purpose of API before dreaming about it.
If you still think you need it - it's fine to make a point in the plan of your site building, and at first make the needed functional blocks of the main application, test it, then only include the service for external use of your application.
Actually it needs for project purpose. If you consider security, it is necessity to build an API at beginning.
Anyone who has had to refactor to build their API will want to avoid doing this the next time. It is totally consistent with rapid release of your product. Any well architected web app will have a data layer, a logic layer and a presentation layer. The API is merely the ability to access the data and logic layers directly in order to put additional presentation layers on top of them.