{"id":28515146,"url":"https://github.com/axelrothe/ninox","last_synced_at":"2025-07-05T09:31:27.440Z","repository":{"id":49804891,"uuid":"504966409","full_name":"AxelRothe/ninox","owner":"AxelRothe","description":"javascript wrapper for Ninox REST API","archived":false,"fork":false,"pushed_at":"2025-06-20T14:22:03.000Z","size":23,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T13:47:44.565Z","etag":null,"topics":["api","ninox","rest","restful","wrapper-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AxelRothe.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-18T22:52:20.000Z","updated_at":"2025-06-20T14:22:06.000Z","dependencies_parsed_at":"2024-06-11T08:59:32.080Z","dependency_job_id":"c9c42040-26cd-4eba-a992-c28ef7b36ca8","html_url":"https://github.com/AxelRothe/ninox","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.2857142857142857,"last_synced_commit":"082906f442aae4d70cd5b5148c9b0d73a9cab877"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AxelRothe/ninox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxelRothe%2Fninox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxelRothe%2Fninox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxelRothe%2Fninox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxelRothe%2Fninox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxelRothe","download_url":"https://codeload.github.com/AxelRothe/ninox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxelRothe%2Fninox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263718306,"owners_count":23500806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","ninox","rest","restful","wrapper-library"],"created_at":"2025-06-09T02:38:24.821Z","updated_at":"2025-07-05T09:31:27.434Z","avatar_url":"https://github.com/AxelRothe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![‘npm version’](http://img.shields.io/npm/v/ninoxjs.svg?style=flat) ![‘downloads over month’](http://img.shields.io/npm/dm/ninoxjs.svg?style=flat)\n\nninoxjs \n========================\n\n## 🤔 What is this?\n\nThis is a lightweight JS library for the Ninox REST API. This allows you to easily use the REST API in your JavaScript app without needing to look up your library ids and team ids or handle data encoding.\n\n## 💡 What can I use it for?\n\nI personally used this library to write endpoints for the following services:\n - server for app payment and license management\n - data analysis tools to analyse trends in data\n - employee dashboards\n - ticket systems\n - and more \n\nI'm excited to see what you are going to create with these tools. If you have any questions, please contact me at ✉️ [a.rothe@vanrothe.com](mailto:a.rothe@vanrothe.com)\n\n---\n\n**Can I help?** Submit your pull request with a detailed explaination or create a discussion beforehand.\n\n---\n\n## 🚀 Install\n\n```shell\nnpm install ninoxjs --save\n```\n\n```js\nconst ninox = require('ninoxjs');\n//or\nimport ninox from 'ninoxjs';\n```\n\n## 🧑‍🏫 Usage\n\n`ninox.auth(options : NinoxOptions)` must be called once before using the API.\n\n```javascript\nimport ninox from 'ninoxjs';\n\nninox.auth({\n    uri: \"https://api.ninoxdb.de\", //optional\n    version: \"1\", //optional\n    authKey: \"xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    team: \"YOUR_TEAM_NAME\",\n    database: \"YOUR_DATABASE_NAME\",\n}).then(() =\u003e {\n\tconsole.log(\"Auth successful\");\n\n\tninox.getRecords('YOUR_TABLE_NAME').then(records =\u003e {\n\t\tconsole.log(records);\n\t})\n}).catch(err =\u003e {\n    console.log(\"Failed to connect to Ninox Cloud\", err);\n});\n```\n---\n## Types\n\n### NinoxRecord\n\n```javascript\n/**\n * @typedef {Object} NinoxRecord\n * @property {number} id - The id of the record\n * @property {number} sequence - The sequence of the record\n * @property {string} createdAt - The date the record was created\n * @property {string} createdBy - The user that created the record\n * @property {string} modifiedAt - The date the record was updated\n * @property {string} modifiedBy - The user that updated the record\n * @property {Object} fields - The content of the record\n **/\n ```\n\n**Example:**\n```\n {\n   id: 6,\n   sequence: 97,\n   createdAt: '2022-06-28T19:35:01',\n   createdBy: 'xxx',\n   modifiedAt: '2022-07-02T12:34:39',\n   modifiedBy: 'xxx',\n   fields: {\n       \"Name\": \"My Deliverable\",\n       \"Description\": \"This is a deliverable\",\n   },\n  }\n```\n\n### NinoxOptions\n\n```js\n/**\n* @typedef {Object} NinoxOptions\n* @property {string} teamName - The name of the team to use\n* @property {string} databaseName - The name of the database to use\n* @property {string} authKey - The auth key for the API, can be found or created in the user account settings page of the ninox app\n*/\n```\n\n**Example:**\n```\n{\n    uri: \"https://api.ninoxdb.de\", //optional\n    version: \"1\", //optional\n    authKey: \"xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n    team: \"YOUR_TEAM_NAME\",\n    database: \"YOUR_DATABASE_NAME\",\n}\n```\n---\n## 🔦 Available methods\n\n#### `getRecords(tableName : String, filters : Object, extractFields? : String[], excludeFields? : String[]) : Promise\u003cNinoxRecord[]\u003e`\nRetrieves all `NinoxRecords` from the Table that match the filters.\n\nFilters are always exact matches, use ninox.query to search with greater than, less than and other parameters.\n\n**Usage:**\n```javascript\nninox.getRecords(\n\t'YOUR_TABLE_NAME', // Table name\n    {\n        \"First Name\": 'John', \n        Age : 21,\n        \"Last Name\": 'Doe'\n    },\n    ['name', 'age'] // Fields to extract, leave undefined to extract all fields\n);\n\n// or\nninox.getRecords(\n\t'YOUR_TABLE_NAME', // Table name\n\t{\n\t\t\"First Name\": 'John',\n\t\tAge : 21,\n\t\t\"Last Name\": 'Doe'\n\t},\n    [], //extract all fields\n\t['Phone'] // but exclude the field Phone\n);\n\n\n// returns all NinoxRecords\nawait ninox.getRecords('YOUR_TABLE_NAME').then(records =\u003e {\n    console.log(records);\n})\n```\n\n#### `getRecord(tableName : String, id : Number, extractFields? : String[], excludeFields? : String[]) : Promise\u003cNinoxRecord\u003e`\nReturns a `NinoxRecord` from a table by id\n\n**Usage:**\n\n```javascript\n\n//returns a NinoxRecord with id 123 and trims the data to just the Age field\nninox.getRecord(\"YOUR_TABLE_NAME\", 123, ['Age']).then(function(record) {\n        console.log(record);\n    }\n)\n\n//returns a NinoxRecord with id 123 and all fields\nninox.getRecord(\"YOUR_TABLE_NAME\", 123).then(function(record) {\n        console.log(record);\n    }\n)\n```\n\n#### `saveRecords(tableName : String, records : NinoxRecord[]) : Promise\u003cBoolean\u003e`\nSaves `NinoxRecords` to a table in the database, omitting the id will create a new `NinoxRecord`, with the id will update the `NinoxRecord`\n\n**Usage:**\n\n```javascript\n\n//updates a NinoxRecord with id 1 with the data in the fields object\nninox.saveRecords(\"YOUR_TABLE_NAME\", [{\n\tid: \"1\",\n\tfields: {\n\t\tfield1: \"value1\",\n\t\tfield2: \"value2\"\n\t},\n}]);\n\n//creates a NinoxRecord with the data in the fields object\nninox.saveRecords(\"YOUR_TABLE_NAME\", [{\n\tfields: {\n\t\tfield3: \"value3\",\n\t\tfield4: \"value4\"\n\t},\n}]);\n```\n\n#### `deleteRecord(tableName : String, id : Number) : Promise\u003cBoolean\u003e`\nDeletes `NinoxRecords` from a table in the database.\n\n**Usage:**\n```javascript\nninox.deleteRecord(\"YOUR_TABLE_NAME\", 123).then(function(record) {\n        console.log(record);\n    }\n)\n```\n\n#### `deleteRecords(tableName : String, ids : Number[]) : Promise\u003cBoolean\u003e`\nDeletes all `NinoxRecord`s from a table in the database.\n\n**Usage:**\n```javascript\nninox.deleteRecords(\"YOUR_TABLE_NAME\", [123, 124, 125]).then(function(record) {\n        console.log(record);\n    }\n)\n```\n#### `query(tableName : String, query : String) : Promise\u003cNumber|String|Array\u003e`\n\nAllows you to query the database directly with a NX-Script. \n\n\u003e Note: \n\u003e This acts the same as a Formula, you can not write data.\n\n**Usage:**\n```javascript\nlet name = \"John\"\nlet age = 21;\nn.query(\n`let list := (select YOUR_TABLE_NAME['First Name'=\"${name}\" and Age \u003e= ${age}]);\n for l in list do\n {\n    \"age\": l.Age,\n    \"name\": l.'First Name'\n }\n end;\n`).then(function(result) {\n    console.log(result) // \u003e [{age: 21, name: \"John\"}]\n}).catch(function(err) {\n\tconsole.log(err);\n});\n```\n\n#### `exec(query : String) : Promise\u003cNumber|String|Array\u003e`\nAllows you to execute NX-Script directly on the database.\n\n**Usage:**\n```javascript\nlet name = \"John\"\nlet age = 21;\nn.query(\n`let t := first(select YOUR_TABLE_NAME['First Name'=\"${name}\" and Age \u003e= ${age}]);\nt.Title := \"New Title\";\nt.Title;\n`).then(function(result) {\n\tconsole.log(result); // \u003e New Title\n}).catch(function(err) {\n\tconsole.log(err);\n});\n```\n\n\u003e Note:\n\u003e This acts the same as a Button. Careful with this one, you can write data.\n\n#### `getFile() : Promise\u003cString\u003e`\nReturns the contents of a file from the database.\n\n**Usage:**\n```javascript\nconst RECORD_ID = 123;\nconst FILE_NAME = \"image.png\";\nninox.getFile(\"YOUR_TABLE_NAME\", RECORD_ID, FILE_NAME).then(function(file) {\n    if (file){\n        console.log(\"success\");\n    }\n}).catch(function(err) {\n    console.log(err);\n});\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxelrothe%2Fninox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxelrothe%2Fninox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxelrothe%2Fninox/lists"}