Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jrdavidson's avatar

Is This What An API Is Used For

I'm curious to know everybody's opinion on this one. I am beginning stages of an application that I will be deployed on many servers. This will be a CMS that will house data from all of these other servers that I'm thinking will be best put into a database on my hosting. So what things will I need to think about. For one is this what an API is built for?

0 likes
18 replies
jrdavidson's avatar

So do you think I'm going the right route with what I am doing?

davorminchorov's avatar

Think of API as a consumable service which other programmers use for custom web, mobile or other types of applications. All these types of applications get the same data from that API (they consume it).

Let's take facebook's API for example: they use the same data for the web version, the mobile version, the tablet version and even some custom web/mobile apps by other programmers who want to integrate facebook data on their website.

Facebook's web design is not good enough so if you want a better design, you can design your own facebook version, and use their API to bring the data over (consume it).

1 like
jrdavidson's avatar

Okay. So I"m trying to think if its better to make my application (which is a paid service) transferable and keep their data stored in my DB or should just keep it all on my site because this will be customizable for their company's needs. Since each company will have their own company id for when I retrieve data specific to their company.

dberry's avatar

@xtremer360, my applications/sites are generally always backed by an api. I build the API first, then if I want/need to build an HTTP layer on top of that, then my HTTP consumes my API.

Yes, I think you have a good case for an API, but there is a whole lot more to building an API service than just knowing that you need/could use one.

jrdavidson's avatar

@dberry so your saying I should finish making my application and then decide if I should still have an API and make it then.

dberry's avatar

@xtremer360, did you read what I wrote?

  1. I'm recommending anything to you. I don't know your project and every project is unique.

  2. I believe if a recommendation could be derived out of what I said, my exact quote was:

@dberry60 I build the API first, then if I want/need to build an HTTP layer on top of that, then my HTTP consumes my API.

So from that, I'm not exactly sure how you came to your conclusion.

JeffreyWay's avatar

Guys - unrelated, but attach a photo at gravatar.com. All cowboys above me.

pmall's avatar

@xtremer360 start by making your application in a regular way (database/html front end). You are obviously laking experience for now, it will be confusing.

jrdavidson's avatar

Okay so working on it quite a bit I have thought about how I want to go about this project in reference to it being a paid service.

I want to house the database for ALL companies that are using this service stored on my hosting database and I believe the actual system itself unless someone might give me a good reason not to.

Lets say there is 3 sites that use this service:

www.site1.com www.site2.com www.site3.com

When a user goes to either of those sites and wants to access lets say the name of my project lets say:

www.site1.com/projectname www.site2.com/projectname www.site3.com/projectname

It would then be sent to my site where they would log into my system and it would be able to grab the url and match it verify that it is a company that uses my system and then it would be able to keep separate the users and data separated from the other companies who use it.

Is this something that could be worked?

dberry's avatar

yes...

You are going to have to learn a lot more about API development before you get started though. If you put the brakes on now and take the time to learn what you're doing before trying to do it, you're going to save yourself a lot of time and even money.

Just some links to get you started...

https://leanpub.com/build-apis-you-wont-hate http://restfulwebapis.com/index.html https://www.mulesoft.com/lp/whitepaper/api/secrets-great-api https://laracasts.com/series/incremental-api-development

dberry's avatar
dberry
Best Answer
Level 10

Well, you have two separate issues here... 1) Building an API and 2)building a Multi-Tenant App. You need to learn about both of those. Watching that tutorial (which I've watched) isn't going to address the issue of how to build an API. Approach them both separately and once you understand both concepts, then merge them together.

1 like

Please or to participate in this conversation.