npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fmrest

v2.3.1

Published

A javascript wrapper for Filemaker's Data API (REST API)

Readme

FMREST

Build Status npm version

A Node.js wrapper for Filemaker's Data API (REST API)

This API was tested with Filemaker 18 Data Api and using Filemaker ID login services.

Development is in progress.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You will need Filemaker Server 18 and enable the Data API. There is plenty of online documentation describing how to do this.

I have also supplied my testing file - db.fmp12.

Running the tests

Run all tasks including tests:

npm i gulp-cli -g
gulp

Run only tests:

jasmine

Note: fmrestSpec.js is commented out; uncomment it to test in your own environment

API Code Samples

Almost every function returns a Promise except createRequest, createGlobal and createSort.

Configuration

npm install fmrest


const Fmrest = require('fmrest');


// Set configuration
// Specify fmid for use with your Filemaker ID
const filemaker = new Fmrest({
    user: "user",
    password: "pass",
    host: "host",
    database: "db",
    auth: "fmid", // basic or fmid
//  layout: "db"  // optional at time of login
});

// Layout is not required for authentication anymore
filemaker.setLayout('db'); // need to supply layout eventually

Authentication

// Login
filemaker
    .login()
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    });


// Logout
filemaker
    .logout()
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    });

Records

// Create Record
const values = {
    "name": "Bill",
    "address": "102 park ave",
    "date": "6/21/2017"
}

filemaker
    .createRecord(values) // if empty, creates record w/ default values
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    });


// Delete Record
filemaker
    .deleteRecord(2) // supply with Filemaker's unique interal recordID
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Edit Record
const values2 = {
    "name": "James",
    "address": "105 lake dr",
    "date": "6/22/2017"
}

filemaker
    .editRecord(2, values2)
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Get Record
filemaker
    .getRecord(3)
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Get Record w/ Portal Data
let portal1 = filemaker
    .createPortal('portal1', 1, 2); // (portal name, offset, limit)
                                    // offset and limit are optional
let portal2 = filemaker
    .createPortal('portal2', 1, 2);

filemaker
    .getRecord(3, [portal1, portal2])
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    });


// Get All Records
filemaker
    .getAllRecords()
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Get All Records w/ Portal Data, sorting, offset and limit
let portal1 = filemaker
    .createPortal('portal1');

let sort1 = filemaker
    .createSort('name', 'ascend');

filemaker
    .getAllRecords({
        offset: 1,
        limit: 10,
        sorts: [sort1],
        portals: [portal1]
    })
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    });

// Upload Files to Container Fields
const containerFieldName = 'container';
const containerFieldRep = '1';
const recordId = '3';
const fs = require('fs');
const file = fs.createReadStream(`${__dirname}/filemaker_logo_vert.png`);

filemaker
    .uploadFile({ file, recordId, containerFieldName, containerFieldRep })
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })

Finds

// Find Records
let request = filemaker
    .createRequest()
    .where('name').is('=bill');

filemaker
    .find({requests: [request]})
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Find w/ multiple requests
let request = filemaker
    .createRequest()
    .where('name').is('=bill')
    .where('address').is('102*');

let request2 = filemaker
    .createRequest()
    .where('name').is('=james');

filemaker               // Append .omit() to make the request omit records
    .find({requests: [request.omit(), request2]})
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Find w/ multiple requests and sorting
let request = filemaker
    .createRequest()
    .where('name').is('*');

let request2 = filemaker
    .createRequest()
    .where('address')
    .is('102*');

let sort = filemaker
    .createSort('name', 'ascend');

let sort2 = filemaker
    .createSort('address', 'descend');

filemaker
    .find({
        requests: [request, request2],
        sorts: [sort, sort2]
    })
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })


// Find w/ all optional parameters
let request = filemaker.createRequest().where('name').is('*');

let sort = filemaker.createSort('name', 'ascend');

let portal1 = filemaker.createPortal('portal1', 1, 1);

filemaker
    .find({
        requests: [request],
        sorts: [sort],      // optional
        offset: 2,          // optional
        limit: 10,          // optional
        portals: [portal1]  // optional
    })
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })

Set Global Fields

// Set Global Fields
let global1 = filemaker
    .createGlobal('db::global1', 'aValue');

let global2 = filemaker
    .createGlobal('db::global2', 'anotherValue');

filemaker
    .setGlobals([global1, global2])
    .then(body => {
        console.log(JSON.stringify(body, null, 3));
    })

TODO

  • [x] Layout is optional at login
  • [ ] Add optional fm data source to login body
  • [ ] Add support for OAuth
  • [x] Add support for filemaker id login
  • [x] Add support for Container Data
  • [ ] Global fields are still not working (help :)
  • [ ] Add script query parameters to Records

Resources

Filemaker Data 18 API Guide

Contributing / Code of Conduct

Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details