Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2725 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I want to access a data base «Import.fmp12» hosted on FMS 16 with the new Rest API but cannot get it to work.

Testing with «ARC Plugin for Chrome» (great tool, btw) and Postman.

In ARC, I get the error 802 – Unable to open file; in Postman, I won't even get that far:  «Could not get any response»

 


This is what I did so far:

 – The file is accessible fine with any FileMaker client using FileMaker username and password (triple checked spelling, etc.)

 – Can connect fine to WebDirect with any browser and http

 – Cannot connect using Rest API and http, so went for https

 – Got an authentication error with https, so

 – Installed a self-signed certificate both on the server Mac and on local Mac for my myowndomain.com

Getting mixed results:

 – Firefox: myowndomain.com certificate: Error code: SEC_ERROR_UNKNOWN_ISSUER  (to be expected)

 – Safari: FMI Default Certificate: Certificate not valid (host name mismatch). For whatever reason, Safari doesn't use my certificate.

 – Chrome: strikethrough https but shows the WebDirect server

 – ARC Plugin: Using https://myowndomain.com/fmi/rest/api/auth/Import Can get now through to the server (no SSL-Auth problems anymore), but the result is: {"errorMessage": "Unable to open file","errorCode": "802"}

 – Postman: Using https://myowndomain.com/fmi/rest/api/auth/Import «Could not get any response» and an error message: «{"errorMessage":"Method Not Allowed"}»

 

Any ideas?

Thanks  for any help.

 

Gary

 

Posted

The Data API works through HTTPS only.  With your self-signed cert you will have to get past any warnings from that and most integrations just won't. They'll expect a valid cert with no warnings.  You can configure POSTMAN to disregard SSL warnings (google for that) to get you through the testing but for production you'll need to get a valid SSL cert.

The "method not allowed" may be because you are using the wrong HTTP method for the wrong action.  What is that you are asking the Data API.

Posted

Thanks, Wim!

There are actually a lot of things that need to be checked. That can be tricky for someone like me who is dealing with Rest APi for the first time.

Maybe someone can benefit, so I'll summarizing my experiences:

1) Read the FileMaker documentation
 – FileMaker Rest API Documentation
 – On your own FM Server, read the help pages (for query syntax):
https://localhost:16000, chapter Web-Publishing Resources > FileMaker Data API Documentation.

2) Enable Rest API on the server
Enable Web Server in Web Publishing pane, check your IP address and ports. Sticking with the default ports 80/443 is probably the easiest, though this will make it difficult when you already have another web server running on the same machine.

3) Prepare the FileMaker database
 – Username, Password protected (Password must consist of printable characters; no colon)
 – Open your database in FileMaker 16 and set the database to access fmrest requests: This is being done in File > Manage Security (can't do this on the server or with FM 15).
 – For testing, it’s a good idea to enable WebDirect as well, checking if you can reach the FM Server at all — in case you are having SSL Certificate problems (like me :-).
Everything is ok with the file, when after uploading to the server, in the Activity pane there is a big gray dot in the column «Rest» of your database file.

4) SSL
The API only works with SSL (in fact TLS 1,2). You will need officially signed certificates. I didn't and ran into a lot of problems. You will need to import it into the FM Server: Admin Console > Database Server > Security

If you want to go without SSL, it will depend on your environment whether it will work. When testing the API functionality with ARC plugin for Chrome (great tool) or with Postman (a little bit less intuitive), you can turn SSL checking off. That might do the trick for you. Any production environment will be problematic without a proper certificate (as Wim indicated) and I wouldn't do it, even if it would be possible.

In any case, you must use https, not http.

5) The other side
The majority of users will probably use PHP on the client side. There are at least 2 wrapper scripts that you can use, fmrest for php and
FMDataAPI, of which «fmrest» seems to be better, as it handles the validation process: With every command you send to the FM Server, you need to pass a token, that you need to receive from the server beforehand. fmrest for php does this management for you. That is cool.

I hope this is helpful for someone
For me, it was  :-)

Gary

 

  • 2 weeks later...
Posted (edited)

You would really like to layer this with nginx as a reverse proxy; to reduce the traffic going in to FileMaker Server as follows:

 

My web service is currently layered like this:

nginx reverse proxy with gzip( This is the public IP with HTTPS ) -> REST API written in NodeJS w/express( HTTP on localhost ) -> nginx reverse proxy( HTTP on localhost ) -> FileMaker CWP

 

I'm in the process of altering this to become:

nginx reverse proxy with gzip( This is the public IP with HTTPS ) -> REST API written in NodeJS w/express( HTTP on localhost ) -> nginx reverse proxy( HTTPS on localhost ) -> FileMaker DATA API for testing

Edited by ggt667

This topic is 2725 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.