How to make Api for Delphi application

Posted on 2011-10-09
Medium Priority
Last Modified: 2012-05-12

I have never done such a thing before.
I am thinking of creating of an API interface for my applications written in Delphi.

I am interested in the following:
1.How can I make an api for my Delphi application
2.What are the areas I can use the Api for (at first I thought of data import and export but I am sure there are other useful areas as well)
Question by:starhu
  • 3
  • 2
  • 2
  • +2

Expert Comment

ID: 36939020
what will the API will serve?

you can make your delphi application a WSDL server.... frm here it will generate
an api where external application can talk to and exchange request..

LVL 25

Expert Comment

ID: 36939488
that is a strange question :
usually, someone wants to do something and asks how to do it and/or if some idea would serve the purpose.
YOU have the desire to use some generic technique and are asking how you could use it with your application (2) and precisely which brand of this generic technique you should use (1).

And of course, all that without telling us what your application is doing. There are dozens of dozens of API technology, usage, with pro and cons for each, without a single one better than all on all counts.

Expert Comment

ID: 36941434
There are many possibilites. For example you can easy expand your application to Automation Server.

Other possibility is moving required functionality to separate DLL and you can both use this DLL in your application and document DLL's function for use by external applications.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 21

Expert Comment

ID: 36943779
It will depend largely on the type of application it is.

  If you wrote something akin to MS Word then you would have a GUI application that would be limited in the type of API it could use (A web service would probably be out).  In this case I would probably go with a COM object.  This is coming from someone with many years of experience developing in Windows.  IF you need your application to be cross platform then the solution would likely become much more complicated.

  If the application is a web page, and you want developers to be able to use the functionality of the web site (without needing to use the web pages themselves), then you could easily base your web page on a web service type of API, allowing other developers to access it.

  If the application handles things in a background manner and you want other applications on the same machine (or across a network) to be able to access these pieces of functionality then a service may be what you are looking for (think SQL Server, or any database server, as an example of this type of functionality).

I hope this helps you to quantify what we, as the experts trying to help, would need to understand of your project.

Author Comment

ID: 36970091
Ok, I will clarify this.

I have many business softwares as stock softwares, ERP, CRM etc.

Many people ask me how to connect other business softwares to my softwares. They ask if I can give them an Api specification so their softwares and my softwares can work together as "one".

The idea is if 10 different softwares need to be connected to my software that I don't need to make 10 different contact points but only one which I give to the developers of other companies and they can connect no matter if the other is an invoice system ,a bidding system or a webshop.

Thank you
LVL 25

Expert Comment

ID: 36970699
What do you mean by connect :
a - 'simple' data exchange (in ? out ?)
b - or complex 'functions' calls of your software from others ?

for a), what is your kind of data, do you use a database that can be queried ? maybe you could implement an XML bridge ?
for b) maybe you could create WebServices API

your explanations are better than nothing, but you really should detail the kind of relationship between your softwares and others

Author Comment

ID: 36971082
I need a: simple data exchange both in and out.
I use different databases mostly MySql (but all of them can be queried)

I don't know anything about XML bridge.
LVL 21

Expert Comment

ID: 36972276
 Normally I would do a web service for this type of thing.  If you need to allow other software to... log in... keep a list of stock symbols for their account... do a query to get a list of historic stock data... WHATEVER...  You can make the web service handle several individual calls to perform the various tasks.  Each web service call will have it's own parameters and results.  If you pass a user name and password to a web service (use https to encrypt it) then you could return a session ID that would be a required parameter to use any of the other web service calls.  This would enforce the software using your web service to log in for access.  If the other software makes a call to get a historic list of data for stocks, they would pass the session ID and... a parameter to specify which stocks (blank could be interpreted as all).  I would make the result of the call a string containing XML that could be used by the client software to create a dataset on their end to allow them to see the data.

  I say all of this as examples.  When you do a web service, there are many languages that can read the Web Service Description Language (WSDL) file to enable their code to call your web service.  Doing a web service means that your application would need to run on (or as) a web server.  If you do not want this to be part of your design, you could try to do it as a COM object and have the same functionality (limited to running on Windows).  If all programs accessing your data need to do so concurrently then it should be handled as a single central server (once again indicating something like a web service).  If it is handled as COM then it becomes a COM object running on a server that is accessed by other computers via DCOM.

  Delphi is capable of creating ISAPI DLLs that can be run on a web server.  There are, as the old adage goes, "many ways to skin a cat".  We still do not have much information to go on to help you define your user interface.  You need to determine 1) exactly what capabilities you want to expose 2) what platforms you want to support 3) what technologies you can use to meet those goals and 4) which technology you want to implement from the list.  There is no single right answer to this type of question.  My own experience tells me to let the needs define the implementation.  That is impossible to do without the list of needs...

One more try at guiding you to the details required...
LVL 25

Accepted Solution

epasquier earned 2000 total points
ID: 36973499
You would use a WebService if you need/want your software to constantly run in a server, accessible from anywhere (TCP/IP). For ex. if your system is a CRM program that can track purchase from customers and emit some special offers, it has to be accessible by the retail software at any time.

If your software only prepare data on a regular basis (either because it analyse data from other sources, or because data it generates can be used by other systems 'offline' and be only updated every day or week) , you would have to make a bridge. A bridge is quite simply a data importer/exporter. Most systems uses CSV files or XML files for data exchange. I, for once, have almost every month a project where some system must be coupled with another system (I work with retail systems). 90% is CSV file -based interface, because it's simple, effective, and any low level programmer can do it, so that's what's used by all big companies having a product to interface with anything from anyone.
XML is convenient as a format because it can be hierarchical, and can be expanded easily.
But believe it or not, it's far from perfect, it has some heaviness in the way it must be used, and often requires at least a bit of computer skills to handle properly. I have seen more badly designed XML interfaces than good ones, and while it can work, it's often at a higher cost than expected.

Maybe first you should see what kind of data export can be done directly by your DBMS. I am confident that you have already everything to setup DB tables import/export with CSV and XML. The hard part does not rely in the importation/exportation of the raw data, but in the validation of the data you import in your system. Only you can tell what kind of constraints you have to check, and what to do with a batch of data having only one error (like a ref to a product that does not exist in your DB, in a single invoice... What to do with the 1000+ other good ones ? with the faulty one ?).
A good bridge is capable of checking everything that should be, before actually importing it in the DB, and report in a consistent way errors to the user or the automated system using your bridge.
It should not rely only on the DB constraints and not manage exceptions thrown by the DBMS, and quit with a single error 'Importation failed.' With 50Gb XML files, that is annoying, and good luck to find out that a misplaced space in a field is responsible for the whole thing failing... I'm talking about a real experience, with a badly designed XML bridge, from a big company that should have had the resources to do it right... (I'm not going to name it)

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question