Slide 1

Slide 1 text

Introduction to the FileMaker Data API Steve Winter Matatiro Solutions @steveWinterNZ

Slide 2

Slide 2 text

@SteveWinterNZ - FileMaker, web application and software developer >20 years! - Run Matatiro Solutions - Regular DevCon speaker - Active Open Source developer Who am I? Steve Winter

Slide 3

Slide 3 text

@SteveWinterNZ Introduction to the FileMaker Data API Expectation management - This is a beginner session! - That said, it will move quite quickly - Demo file and code to replicate everything I do - First presented at DevCon 2018

Slide 4

Slide 4 text

@SteveWinterNZ Topics to cover An introduction to REST Where REST and CRUD meet Our friendly Postman Authentication and tokens Configuring FileMaker Server and a FileMaker custom app Interacting with other systems

Slide 5

Slide 5 text

@SteveWinterNZ The end at the beginning FileMaker based inventory management WordPress based website Want to be able to display product data, prices, availability etc on site WordPress plugin is available for you to use

Slide 6

Slide 6 text

@SteveWinterNZ Demo

Slide 7

Slide 7 text

@SteveWinterNZ An introduction to REST “ “” Wikipedia Representational State Transfer (REST) is an architectural style that defines a set of constraints and properties based on HTTP. Web Services that conform to the REST architectural style, or RESTful web services, provide interoperability between computer systems on the Internet.

Slide 8

Slide 8 text

@SteveWinterNZ An introduction to REST REST-compliant web services allow the requesting systems to access and manipulate textual representations of web resources by using a uniform and predefined set of stateless operations. “ “” Wikipedia

Slide 9

Slide 9 text

@SteveWinterNZ HTTP methods GET “ “” Wikipedia The GET method requests a representation of the specified resource. Requests using GET should only retrieve data and should have no other effect.

Slide 10

Slide 10 text

@SteveWinterNZ HTTP methods POST “ “” Wikipedia The POST method requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI

Slide 11

Slide 11 text

@SteveWinterNZ HTTP methods PATCH “ “” Wikipedia The PATCH method applies partial modifications to a resource.

Slide 12

Slide 12 text

@SteveWinterNZ HTTP methods DELETE “ “” Wikipedia The DELETE method deletes the specified resource.

Slide 13

Slide 13 text

@SteveWinterNZ Resource URI and FileMaker Begin with https://, then - C POST /fmi/data/v1/databases//layouts//records - R GET /fmi/data/v1/databases//layouts//records/ - U PATCH /fmi/data/v1/databases//layouts//records/ - D DELETE /fmi/data/v1/databases//layouts//records/

Slide 14

Slide 14 text

@SteveWinterNZ Demo

Slide 15

Slide 15 text

@SteveWinterNZ Video CRUD.mov goes here

Slide 16

Slide 16 text

@SteveWinterNZ A word of caution The FileMaker Data API URIs use the internal recordID of a record FileMaker recordIDs won’t always refer to the same record This makes the stateless part of REST very important

Slide 17

Slide 17 text

@SteveWinterNZ But what about security? Don’t Panic

Slide 18

Slide 18 text

@SteveWinterNZ But what about security? 1. You have to enable the FileMaker Data API on your server 2. You have to enable the fmrest extended privilege for at least one user 3. That user has to authenticate before they can use the API

Slide 19

Slide 19 text

@SteveWinterNZ Enable FileMaker Data API Demo

Slide 20

Slide 20 text

@SteveWinterNZ Video EnableDataAPI.mov goes here

Slide 21

Slide 21 text

@SteveWinterNZ Data usage Included in your server license Number of users x 2Gb per month x 12 months = annual allowance 3 users x 2Gb per month x 12 = 72Gb Outbound traffic only Aggregated across all users, not just those who use the FileMaker Data API. Error 953 when exceeded. Can purchase additional data if necessary

Slide 22

Slide 22 text

@SteveWinterNZ

Slide 23

Slide 23 text

@SteveWinterNZ Enable the fmrest extended permission Demo

Slide 24

Slide 24 text

@SteveWinterNZ Video EnablePermissions.mov goes here

Slide 25

Slide 25 text

@SteveWinterNZ That user has to authenticate Demo

Slide 26

Slide 26 text

@SteveWinterNZ Video Authenticate.mov goes here

Slide 27

Slide 27 text

@SteveWinterNZ Putting it all together We know what REST is Our server is ready Our app file is ready We have a user with the right credentials Let us go forth and connect with the world!

Slide 28

Slide 28 text

@SteveWinterNZ Connecting WordPress Demo

Slide 29

Slide 29 text

@SteveWinterNZ Using FileMaker Go to connect Demo

Slide 30

Slide 30 text

@SteveWinterNZ What else can we do Call scripts Upload container content Logout Fetch ValueLists (since v18) Gather other metadata (since v18)

Slide 31

Slide 31 text

@SteveWinterNZ Connecting from JavaScript Demo

Slide 32

Slide 32 text

@SteveWinterNZ Upload container content Demo

Slide 33

Slide 33 text

@SteveWinterNZ FileMaker Data API documentation https:///fmi/data/apidoc

Slide 34

Slide 34 text

@SteveWinterNZ Integration resources Lots of ‘packages’ to help make things easier - See: https://community.filemaker.com/docs/DOC-9197 - FileMaker: examples in the demo files for this session - JavaScript: see the resources for this session - PHP: by Mark Denyse, https://github.com/driftwoodinteractive/fmPDA - .NET: by Wim Decorte, https://github.com/wimdecorte/FMdotNet__DataAPI - Python: by David Hamann, https://github.com/davidhamann/python-fmrest - node.js: • feathers: by Todd Geist, https://github.com/geistinteractive/feathers-filemaker - WordPress: see resources from this session - NativeScript: see resources from this session

Slide 35

Slide 35 text

@SteveWinterNZ Questions?

Slide 36

Slide 36 text

@SteveWinterNZ Session Materials https://bit.ly/fds-dapi

Slide 37

Slide 37 text

@SteveWinterNZ