13 Replies Latest reply on Mar 1, 2016 7:32 AM by taylorsharpe

    Restful API's


      Hi There,


      We use an existing 3rd party browser project management app called Workflow Max. I want to build some layouts that help us remove excel and sync with Workflow Max.


      They have an API based on Restful principles.


      http://api.workflowmax.com/cost.api/get/123?apiKey=[your API key]&accountKey=[WorkflowMax account key]

      I would love to be able to pull information from this system, like our cost list, into a table/fields automatically. If I am able to push information from my layout back the other that would be amazing.

      Is it possible and how complex is it to setup?

      Will I need FM Server to do this?

      Here is a link to the API information they provide.

      Developer API - Overview



        • 1. Re: Restful API's

          I have implemented a restful connection to Exact (Accounting Software) and some other 3rd party providers. 


          You can do it with the standard FileMaker functionality (GetURL) and AppleScript.  But I ended up using a plugin like Base Elements, mainly due to authentication.


          Restful is "easy" in the way that all you need is an url to send or request information.  The hard part is figuring out how to construct the url.  I skimmed through the API and they have nice examples so that shouldn't be a problem.


          All you need in the end is a curl call (GET or POST/PUT)


          You don't need FileMaker Server unless you want updating on the background.  (or as was in our case, let FM Server handle the authentication, ie OAUTH )


          In your case it looks like you just need the insert from URL script step, you only need the field on the layout all the time to insert into.


          Happy Coding

          • 2. Re: Restful API's

            Hi Shane


            The information you need to send to retrieve the cost list is your API key and your Account key, in order to send to WorkFlowMAx the following request:


            http://api.workflowmax.com/cost.api/list?apiKey=[your API key]&accountKey=[WorkflowMax account key]&page=1

            You can use Insert from URL script step to send this request and get the answer in a field, that you then need to parse into fields. This might be the tricky bit actually!


            Good luck



            • 3. Re: Restful API's

              if you need more control about HTTP headers, authentication or SSL, I recommend you check the MBS Plugin's CURL functions.


              See here



              The page has three examples which use REST.

              We also have a lot of JSON functions to build query or parse result.

              • 4. Re: Restful API's

                Hi Christian


                Apparently the answer is XML and not JSON, which is a change!

                Would you know or advise any plug-ins to deal with xml answers?



                • 5. Re: Restful API's

                  No, you don't need FMS to connect to a REST Web Service.


                  I routinely connect to Restful APIs on REST Web Services I've written myself to do various things like return statistical approximation results or other data. While I could have written these statistical routines, as one example, in FMP, sharing those routines would mean an expensive FMS set up whereas the web service is free and thousands use it.


                  In any case, to access REST stuff, all I use is the INSERT FROM URL script step to do this connectivity. If you have FMP 13 or greater than you have both POST and GET available.


                  I'm a huge non-fan of FMP plug-ins due to their unusually high cost relative to other platforms, and I choose to keep everything generic and separate. I may be in the minority, but I just use FMP with what it has.


                  But perhaps a plug-in might be something for you to consider based on your needs.




                  - m

                  • 6. Re: Restful API's

                    Our plugin can work with SOAP and XML, too.




                    • 7. Re: Restful API's

                      The BaseElements plugin has that capability too: BaseElements Plugin | Goya Pty Ltd

                      • 8. Re: Restful API's
                        Would you know or advise any plug-ins to deal with xml answers?


                        FileMaker can use XSLT with XML import, which could be done through HTTP request.

                        • 9. Re: Restful API's

                          Yes indeed, and I've used it before, but not in an API context.

                          Once I've got the xml text back from my request, could I use the Import Record script step on a field or variable?

                          • 10. Re: Restful API's

                            nicolai is correct! my caveat is that sometimes you need to a use web service that has a request-acknowledgement-request-response cycle. Your API documentation will tell you if this is the case. If you must go through this 4-step process then HTTP request (two steps) alone will not work.



                            • 11. Re: Restful API's

                              If your response comes back as FMPXMLRESULT grammar, then you can import without XSLT. It's highly unlikely to be the case, so an XSLT is used to transform one schema/grammar into what will import into FileMaker.


                              If you use XSLT it can import into many fields. If you have "related" data, then you would need several XSLT, because you can only import into one table/layout at a time.


                              Yes, you can import the raw XML into one field, but then you need to "parse" all the bits out.


                              • 12. Re: Restful API's

                                Thanks beverly!


                                I just realised about the HTTP Request field in the Import dialog for XML, which means that if I was in that case I actually wouldn't really need to use Insert from URL at all. Marvellous!


                                Popeye007 if you need help with the XSLT, this article has massively helped me in the past: http://bluefeathergroup.com/blog/importing-xml-data-into-filemaker-using-xslt-xsl-style-sheets/



                                • 13. Re: Restful API's

                                  Popeye007, others have noted that you can use FileMaker's built in Insert from URL script step, but it is limited and 3rd party plugins are more powerful.  For HTTP POSTs and Restful API calls, you will see a lot of people using the free Base Elements plugin from Goya.  The price is right and if you make a lot of use of it, you can make a contribution to Goya, but they don't ask for any money.  It really is a good and stable plugin.  It works fine both on FileMaker Pro and FileMaker Server. 


                                  For some more power, the Monkey Bread Software plug is kind of the swiss army knife of plugins with over 3000 functions.  It not only works with these types of APIs, but it has the entire CURL library, encryptions, image manipulations, email, hashing, XML/JSON manipulation, and literally hundreds of functions I can't even figure out.  When you see Christian Schmitz posting here, he is the owner of the company that developed MBS and he's quite involved in the FileMaker community.  It is not the free solution, but I find it solves so many of my clients needs, I probably have it on about half of their servers.  I usually just install it on the server and make "Perform Script on Server" calls to it from the clients so that end users don't need the plugin. 


                                  I recommend both of these plugins if you want to do API development with secure HTTP POSTs/GETS/PUTS, etc. 

                                  1 of 1 people found this helpful