This topic is locked

REST API Only Apps

8/26/2021 12:58:41 AM
PHPRunner General questions
K
klyle author

In the latest build of 10.6, it seems to not be possible to build an API only application, i.e. skip database selection? Is that on purpose? Is there some trick I am missing? I would like to understand if there was a design decision to force a database connection, which is not always necessary, and results in having to keep a database online just for a placeholder. Thanks!

HJB 8/26/2021

Database API: SetConnection()

Above URL content provides example code on how to forcibly select a database
and how to return to a dummy database as placeholder after code execution.

A
acpan 8/27/2021

@HJB, he asked not to have DB connection and you showed him a link suggesting how to "forcibly" select DB connection, and there is zero mention of dummy database and placeholder in the link!

HJB 8/27/2021

@acpan - "... only API application ...." means that the "provider" wants to be able to pile up numerous apps in junctions with numerous (different) databases to run as a portfolio.
From that point of view, such "provider" need to first own a a simple (say dummy database to return to after a specifc API hasdone its job ...) and a method to dedicate each API
to a specific database forcibly by adequate code. In regard to your "asked NOT to have DB connection" ..., what is your suggestion to do? Or is is just to aim to ridicule something
from my end which could really work? Sure, you can only generate code via PHPRunner once you connect to a database, right? Please provide seomthing better than mine or
better read and even better try to understand of what had been asked for before trying put me into the corner to be an idiot who cannot read and understand at all. Thank you!

A
acpan 8/27/2021

Stop spamming the forum with rubbish, just keep quiet if you do not have an answer or add value, and mislead people to waste their time. And point me where in the link that said about dummy database and placeholders?? there are other people who search for advices too and read your irrelevant posts and waste time! This is a question only the developer can answer, if the mandatory DB connection was a change feature in 10.06, he just wanted to know that, not "how to forcibly select DB" and read something in the manual that only exists in your imagination.

K
klyle author 8/27/2021

@HJB and @acpan, Thanks for engaging with my question.

At this point, it does seem easiest to just connect up some dummy database, so that my API calls can work. I thought that the simplest would be Excel or Access, but I have never gotten those to work on the internal webserver. The Access trial did work when I published it to the Demo Server. Anyway, I think I will create an empty MySQL database somewhere to serve as the "dummy".

The odd thing is that https://xlinesoft.com/phprunner/docs/rest-api-connections.htm seems to be the entry point to this subject, and doesn't mention that the API connections need to be able to write to a database, or that mirror tables need to be created for any REST views...that would seem to require a lot of maintenance.

So far, I have gotten football-data, a weather site, and one more API to return data, and the last two in my app published to the Demo Server.

I am going to do a test with a MySQL dummy database and report back.

I do think that whoever said that only the developer can answer this was correct - from the docs, I don't understand why it is required to connect to a database, but would like to, and have this addressed if it is not strictly necessary for some reason.

Again, thanks for the engagement.