Skip to content

goto10/Vapor-FileMaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vapor - FileMaker Server Connector

Swift 3.0 Platforms OS X | Linux License Apache

This project provides access to FileMaker Server databases using the XML Web publishing interface.

This package is a Vapor port of the Perfect-FileMaker project.

Ensure you have installed and activated the latest Swift 3.0 tool chain.

Linux Build Notes

Ensure that you have installed curl and libxml2.

sudo apt-get install libcurl4-openssl-dev libxml2-dev

Building

Add this project as a dependency in your Package.swift file.

.Package(url: "https://github.com/goto10/Vapor-FileMaker.git", majorVersion: 1, minor: 0)

Examples

To utilize this package, import VaporFileMaker. All responses come back as JSON and conform to ResponseRepresentable

List Available Databases

This snippet connects to the server and has it list all of the hosted databases.

drop.get("dblist") { request in 
	let fms = FileMakerServer(host: testHost, port: testPort, userName: testUserName, password: testPassword)

	return try fms.databaseNames()

}

List Available Layouts

List all of the layouts in a particular database.

let fms = FileMakerServer(host: testHost, port: testPort, userName: testUserName, password: testPassword)
let layoutList = try fms.layoutNames(database: dbName)

List Field On Layout

List all of the field names on a particular layout.

let fms = FileMakerServer(host: testHost, port: testPort, userName: testUserName, password: testPassword)
let layoutInfo = fms.layoutInfo(database: "FMServer_Sample", layout: "Task Details")

Find All Records

Perform a findall and print all field names and values.

let query = FMPQuery(database: "FMServer_Sample", layout: "Task Details", action: .findAll)
let fms = FileMakerServer(host: testHost, port: testPort, userName: testUserName, password: testPassword)

let results = fms.query(query)

Find All Records With Skip & Max

To add skip and max, the query above would be amended as follows:

// Skip two records and return a max of two records.
let query = FMPQuery(database: "FMServer_Sample", layout: "Task Details", action: .findAll)
	.skipRecords(2).maxRecords(2)
...

Find Records Where "Status" Is "In Progress"

Find all records where the field "Status" has the value of "In Progress".

let qfields = [FMPQueryFieldGroup(fields: [FMPQueryField(name: "Status", value: "In Progress")])]
let query = FMPQuery(database: "FMServer_Sample", layout: "Task Details", action: .find)
	.queryFields(qfields)
let fms = FileMakerServer(host: testHost, port: testPort, userName: testUserName, password: testPassword)
let results = fms.query(query)

About

A stand-alone Swift wrapper around the FileMaker XML Web publishing interface, enabling access to FileMaker servers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages