INSERT FROM URL (micro-service style)

Just prototyped a micro-service method that accepts all the URL, data, headers, and such, makes the Request itself, and returns the Response.

This prototype works with FileMaker and it works without FileMaker -- that is, from another program, process, or whatever.

This example uses POST to pass all the parameters so large request bodies are supported. (FileMaker is excellent at being able to pass huge request bodies!).

Of course, it still uses the INSERT FROM URL in FileMaker (since that's how we call a URL in Filemaker), but in this case only to pass the variables to the micro-service method which actually does the connection, sends the data & headers, and then returns the Response.

OK, given how useful INSERT FROM URL is by itself, I doubt this approach would be useful as is for FileMaker devs, but possibly a standalone utility that goes out and hits a URL then populates a FileMaker (or other) DB might be useful. In that case, no FileMaker front-end app would be necessary. Instead, just a scheduled task (Mac/Windows/Linux) and a FileMaker or FMS-accessible database by URL.

The approach might also be useful from another program, from the command line or even from the browser where you could, for example, as shown above, do a POST right from the URL (since the browser is just sending the string to the REST service which reads what Request method to use.)

@anon45965781 this sounds very interesting - is this micro service something you could share perhaps?

1 Like

Wow, I didn't expect a reply on this thread! :slight_smile:

The micro-service method was written for the sparkjava framework (sparkjava.com) but basically behind the scenes just uses the "HTTPUrlConnection()" class. From that, you can send data, read the response, etc., using input and output streams.

There are tons of online examples showing how to use HTTPUrlConnection() but I can't assume you're using Java so check the equivalent method (and online examples to get started) for the language you're using.

If you're stuck on a particular coding technique, please post your code and the folks here (@WimDecorte, for example, is also a micro-services expert) and I will often chime in and try to help.

Happy Coding! :slight_smile:

thank you, i’ll give it a go, probably with Python. :grinning:

I use python all the time but mostly for ML, math/science-related stuff, and things that libraries like Pandas can help with. Python’s REST capabilities are fine too. Packaging and dependency management notwithstanding, I also wrote an article a while back showing how you can create an initial working "Hello World" Python Flask REST service by just creating that project type in JetBrains' PyCharm.

FileMaker’s support for java is so strong, however, and maven’s dependency management is so good, Java is my first choice for most non ML-apps.

Happy coding. :nerd_face:

yes, learning some Java is on my To Do List. Maybe if the Covid crisis keeps going I will finally find time to get around to it!

LOL. I’ve been doing java for about 18 years, nearly full time, and I’m still learning new things every day. :sunglasses:

1 Like