EasyFM - v5.0.0-beta.8
    Preparing search index...

    Getting Started

    This guide gets easy-fm from install to first successful read.

    import { Database, DataApiProvider } from '@jd-data-limited/easy-fm';

    const database = Database.create({
    provider: new DataApiProvider({
    hostname: 'https://example.com',
    database: 'Contacts',
    credentials: {
    method: 'filemaker',
    username: process.env.FM_USERNAME!,
    password: process.env.FM_PASSWORD!,
    },
    externalSources: [],
    }),
    });

    Most projects start with method: "filemaker".

    If you need other auth modes, read authentication-and-sessions.md.

    const contacts = database.layout('Contacts_API');
    

    This matters because FileMaker Data API works through layouts, not directly through tables.

    If a field is not available on the layout, you usually cannot read or write it through that layout.

    const records = await contacts.records
    .list({
    portals: {},
    limit: 25,
    })
    .fetch();

    Then use field values:

    for (const record of records) {
    console.log(record.fields.FirstName.value);
    }
    import { query as q } from '@jd-data-limited/easy-fm';

    const records = await contacts.records
    .list({
    portals: {},
    requests: [
    {
    req: {
    Status: q`Active`,
    Email: q`*@example.com`,
    },
    },
    ],
    limit: 10,
    })
    .fetch();

    query handles FileMaker escaping rules for you.

    const record = records[0];
    record.fields.LastSeenAt.value = new Date();
    await record.commit();

    Changes are local until commit() runs.

    await database.close();
    

    Do this when your script or job is finished.