Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mindfiredigital/fmdapi-node-weaver


https://github.com/mindfiredigital/fmdapi-node-weaver

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

fmdapi-node-weaver





Simplify the integration of FileMaker databases with any frontend

The `@mindfiredigital/fmdapi-node-weaver` is a tool that allows developers to integrate multi page document editors built on top of Canvas using React.


![FM_DataApi_Bundler_Image](https://github.com/BasudevBharatBhushan/node-data-api/assets/64151314/c225d6ac-2d87-4c28-84c7-a950a58d2d12)
**NOTE:** : The endpoints shown in figure are for demo purpose, these are not actual endpoints. For actual Data API endpoint, refer documentation

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Contributing](#contributing)
- [License](#license)


## Features

- **No Mandatory Session Token**: Unlike the standard FileMaker Data API, the Bundler does not require a validated session token for every API call. It handles authentication using Basic Auth, generating a new session token if one is not provided or if the session has expired.

- **Uniform API Endpoints**: Each API endpoint in the Bundler follows a consistent style, simplifying usage and reducing confusion. Regardless of the specific API functionality, you'll find a consistent method structure.

- **Automatic Session Management**: Users don't need to worry about re-validating their session each time they interact with the API. The Bundler automatically manages sessions by using Basic Auth as an authentication header.


## Installation

To install the @mindfiredigital/fmdapi-node-weaver npm package in your project, use the following command:

```bash
npm install @mindfiredigital/fmdapi-node-weaver
```

- **Initialization**: Initialize the fmdapi-node-weaver in your project, specifying the function.

```javascript
const fm = require("fmdapi-node-weaver");

const PORT = 9000;

fm.run(PORT);

//If PORT is not specified, it will run on default port 8000
```

## Installation (Without using NPM)

To download the project `@mindfiredigital/fmdapi-node-weaver` into your system, use the following command:

```bash
git clone https://github.com/mindfiredigital/fmdapi-node-weaver
```


## Getting Started

- **Initialization**: Install the dependencies from the package.json:

```bash
npm i
```

or

```bash
yarn
```

- **Launch the server**

```bash
node app.js
```


## Docker Integration

To containerize your application using Docker, follow these steps:

- **Build Docker Image**: Build the Docker image using the provided Dockerfile:

```bash
docker build -t fmdapi-node-weaver .
```

- **Run Docker Container**: Run the Docker container, mapping the desired port (e.g., 3000) to the container's port:

```bash
docker run -p 3000:3000 fmdapi-node-weaver
```

## API format:

### Endpoint - `api/dataApi`

- eg. `http://localhost:8000/api/daApi`

### Method - POST

### Body Format

```
{
"fmServer":"",
"method":"",
"methodBody":{},
"session":{
"token":"",
"required":
}
}

```

### Body Examples

- ### Signin

```
{
"fmServer":"",
"method":"signin",
"methodBody":{
"username":"",
"password":"",
"database":""
},
"session":{
"token":"",
"required":
}

}
```

- ### Signout

```
{
"fmServer":"",
"method":"signout",
"methodBody":{
"database":"",
},
"session":{
"token":"",
"required":""
}
}
```

- ### CreateRecord

```
{
"fmServer":"",
"method":"createRecord",
"methodBody":{
"database":"",
"layout":"",
"record":{
"Name": "Varun Sharma",
"Phone": "11111111111",
"Address":"Newyork"
}

},
"session":{
"token":"",
"required":
}
}

```

- ### GetAllRecords

```
{
"fmServer": "",
"method": "getAllRecords",
"methodBody": {
"database": "",
"layout": "",
"offset":"1",
"limit": 10

},
"session": {
"token": "",
"required":
}
}
```

- ### FindRecord

```
{
"fmServer":"",
"method":"findRecord",
"methodBody":{
"database":"",
"layout":"",
"offset": 0,
"limit": 0,
"layout.response": "string",
"dataformats":0,
"query":[
{"Name": "=Basudev", "Password": "=1234"},
{"Phone" : "11111111111", "omit" : "false"}
],
"sort":[
{"fieldName": "CreationTimestamp","sortOrder": "ascend"}
],
"scripts":{
"script": "",
"script.param": ""
"script.prerequest": "",
"script.prerequest.param": "",
"script.presort": "",
"script.presort.param": ""
},
"portal": [
""
]
},
"session":{
"token":"",
"required":
}
}
```

---

- ### ExecuteScript

```
{
"fmServer":"",
"method":"executeScript",
"methodBody":{
"database":"",
"layout":"",
"script": "",
"param":""
},
"session":{
"token":"",
"required":
}
}
```

---

- ### UploadContainer

```bash

curl --location 'api/dataApi' \
--header 'Authorization: Basic ' \
--form 'method="uploadContainer"' \
--form 'fmServer="208.85.249.144"' \
--form 'database=""' \
--form 'layout=""' \
--form 'upload=@"/to/path/sample.pdf"' \
--form 'recordId="1"' \
--form 'fieldName="File"' \
--form 'fieldRepetition="1"' \
--form 'token=""' \
--form 'sessionRequired=""' \
```

---

## Contributing

We welcome contributions from the community. If you'd like to contribute to the `fmdapi-node-weaver` npm package, please follow our [Contributing Guidelines](CONTRIBUTING.md).

## License

Copyright (c) Mindfire Digital llp. All rights reserved.

Licensed under the MIT license.