I'm interested in working with an API that's not currently supported (Plaid dot com). They have several language bindings available, but of course nothing for Delphi specifically.
Their examples use curl to communicate with their services.
It would be nice if we had access to the import tool from the pas2js guys, as it could be used to import the node.js lib.
What's the best way to approach working with new APIs like this? Do you just use curl? Or build a simple REST client with json?
If they have a swagger spec / endpoint available (if that's the right term), can that be used to create something?
I'm curious how others approach working with new APIs?
I'm not sure how you expect to use a node.js lib in TMS WEB Core?
node.js is for the server side, TMS WEB Core is for the client side.
I don't know squat about JS or the differences between all of the libraries. The site (Plaid dot com) has it listed as one of several language bindings for accessing their API. Maybe look at the site and see if you can figure out what they're talking about. (They also have a client-side Node library if that helps clear anything up.)
My question is the same: how does one typically approach working with an API in WebCore that has no interface or binding or anything available but a spec available?
I don't have much experience with this stuff, have been trying to learn it bit by bit, and get flack a work anytime I try to bring it up. So please be patient with me.
I had to face a similar situation and found out that most, if not all of these APIs are based on standard HTTP requests. It's just that the parameters you pass are different. Having a very quick look in the documentation of that
plaid.com here , you can read:
API protocols and headers
The Plaid API uses POST requests to communicate and HTTP response codes to indicate status and errors. All responses come in standard JSON.
In order to communicate with an API using HTTP requests, use the
TWebHttpRequest component. So called POST parameters are key/value pairs to be added to the service-URL, like so:
You have to do this yourself unfortunately. Make sure the final URL is a valid URL. Larger parameter blocks of information are typically converted to JSON and put into the PostData property of the component. The response comes in the components OnRequestResponse event. You will find the HTTP response code in
ARequest.req.Status and the reponse text in AResponse, which you have to convert back from a JSON string into a JSON object.
Hope this gives a first idea on how to start. I went through the same pain...
Thanks, that's very helpful.