ggizmo-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

node-gizmo-api

Gizmo API Library for Node.js (NOT OFFICIAL)

GCGApp Build Status

Installation

Read Gizmo API Documentation - link

npm install ggizmo-api

Quick Example

const api = require('ggizmo-api')

async () => {
    try {
        // Make sure you have the correct port open and the web portal enabled in the settings.
        // Enable Bearer | Basic token use True | False
        const con = new api(true, {
            host: "localhost",
            port: 80,
            ssl: false,
            username: 'admin',
            password: 'admin'
        });
        
        //Generate new Token
        await con.createToken()
        
        //Using APIv2
        const v2 = con.v2()
        
        //Simple Fetch query
        const test = await v2.UserGroups.Get()
        const data = await test.json()
        
        console.log(data)
    } catch (err) {
        // ... http error checks
    }
}

Commands

All commands are identical to the requests that are specified in your server documentation (http: //localhost/doc/index.html) Example:

APIv2 => UserGroups => GET QUERY = v2().UserGroups.Get(Options)

Here we use the GET request of the Usergroup

Available Commands

  • AppCategories
  • AppDeployments
  • AppEnterprises
  • AppExecutables
  • AppGroups
  • AppLicenses
  • AppPersonalFiles
  • Apps
  • AppTasks
  • Assets
  • AssetTransactions
  • AssetTypes
  • Attributes
  • BillingProfiles
  • DepositTransactions
  • HostGroups
  • HostIcons
  • Hosts
  • InvoicePayments
  • Invoices
  • MonetaryUnits
  • Operators
  • PaymentMethods
  • ProductGroups
  • Products
  • ProductsStock
  • Registers
  • RegisterTransactions
  • Reservations
  • SalePresets
  • StockTransactions
  • Taxes
  • UserGroups
  • Users
  • Variables

Token

You can use Basic authorization or Bearer

const init = new api(true, { username:'admin',password:'admin' })
await init.createToken()
//Authorization: Bearer Generated Token

const init = new api(false, { username:'admin',password:'admin' })
//Authorization: Basic base64(username:password)

Also, if you already have a Token, you can specify it during initialization.

const init = new api(true, { token: '{TOKEN}' })

License

GGizmo-API is released under the MIT License

Package Sidebar

Install

npm i ggizmo-api

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

115 kB

Total Files

41

Last publish

Collaborators

  • keza3d