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 🙏

© 2024 – Pkg Stats / Ryan Hefner

trackvia-api

v1.9.0

Published

Node SDK for Trackvia's openapi.

Downloads

79

Readme

API-Node-SDK

Node SDK for working with application data in TrackVia.

Getting Started

Login to your Trackvia account and navigate to https://go.trackvia.com/#/my-info. Copy down the API key and Account ID.

Install via npm:

npm install trackvia-api

Include the source directly:

Include the build/trackvia-api.js into your project.

Create an instance of the Trackvia api with your API key:

var TrackviaAPI = require('trackvia-api'); // if installed through npm
var TrackviaAPI = require('./path/to/trackvia-api.js'); // if include manually

var api = new TrackviaAPI('YOUR KEY HERE', 'ACCESS TOKEN HERE', 'HOST', 'ACCOUNT ID');

Authenticating

You must authenticate before accessing any data in Trackvia. There are two methods to properly authenticate: #login() and #setAccessToken(). With the API Authorization release, an access token can also be passed via the constructor.

TrackviaAPI constructor

var api = new TrackviaAPI('myAPIKey', 'myAccessToken', 'https://go.trackvia.com', 12345);
// Successfully authenticated..
// Make additional request in here

#setAccessToken()

api.setAccessToken('myAccessToken');
// Successfully authenticated..
// Make additional request in here

#login()

api.login('[email protected]', 'myPassword')
.then(() => {
    // Successfully authenticated..
    // Make additional request in here
});

Methods

All methods return a Promise. These Promises will resolve to an object (JSON response from the request), except for files, which will resolve to a string of the binary representation of the file.


login(username, password)

Authenticates as specified user.

Parameters:

  • username : string
    • Username of Trackvia account.
  • password : string

getApps()

Gets all apps available.

Parameters: none


getAppByName(name)

Get an app by name.

Parameters:

  • name : string

getUsers([paging])

Get all users, optionally paged.

Parameters:

  • [paging : object]
    • Properties:
      • start : number
        • Starting index for paging.
      • max : number
        • Page size.

addUser(userInfo)

Add new user.

Parameters:

  • userInfo: object
    • Properties:
      • email : string
      • firstName : string
      • lastName : string

getViews()

Get all views.

Parameters: none


getViewByName(name)

Get view by name.

Parameters:

  • name : string

getView(id, [paging , query])

Get view by id, optionally paged, and optionally filtered records.

Parameters:

  • id : number
  • [paging : object]
    • Properties:
      • start : number
        • Starting index for paging.
      • max : number
        • Page size.
  • [query : string]
    • Filter record results in view

getRecord(viewId, recordId)

Get record by id.

Parameters:

  • viewId : number
  • recordId : number

addRecord(viewId, recordData)

Add new record.

Parameters:

  • viewId: number
  • recordData : object
    • Key value pair of field names and values for new record.

updateRecord(viewId, recordId, recordData)

Update exisiting record.

Parameters:

  • viewId : number
  • recordId : number
  • recordData : object
    • Key value pair of field names and values to update in record.

updateRecords(accountId, appId, tableId, recordData)

Batch Update existing records.

This method is not offically supported by TrackVia.

Parameters:

  • accountId : number
  • appId : number
  • tableId : number
  • recordData : object
    • { 'data': [{id: 123, value: 'newValue', type: 'currency', fieldMetaId: '456'}], recordIds: [1, 2, 3] }

deleteAllRecordsInView(viewId)

Delete all records in a view.

Parameters:

  • viewId : number

deleteRecord(viewId, recordId)

Delete record.

Parameters:

  • viewId : number
  • recordId : number

getFile(viewId, recordId, fieldName, [options])

Get a file from a record.

Parameters:

  • viewId : number
  • recordId : number
  • fieldName : string
  • [options : object]
    • Properties:
      • width : number
        • Desired width of image file
      • maxDimension : number
        • Desired max dimension for image file
      • NOTE: These options only apply when the file is an image. Options are mutually exlusive, but if both are defined, only the width will be used).

attachFile(viewId, recordId, fieldName, filePath)

Attach a file to a record (or overwrite and existing file).

Parameters:

  • viewId : number
  • recordId : number
  • fieldName : string
  • filePath : string
    • Path to file being attached

deleteFile(viewId, recordId, fieldName)

Delete file from record.

Parameters:

  • viewId : number
  • recordId : number
  • fieldName : string

getAccessToken()

Get access token for authentication.


getUserKey()

Get user key for authentication.

Additional Information

For additional information visit https://developer.trackvia.com/. Note that the endpoints explained in the docs are from the public api itself. This library is a wrapper around those endpoints to make development easier.

Testing

git clone [email protected]:Trackvia/API-Node-SDK.git cd API-Node-SDK npm install

Create a file testConfig.js by copy and pasting from testConfig.template.js. Open this new file in your text editor and set up a test app and test table in your account according to the instructions. For screenshots of the test setup, open /test/testInstructions.html.

npm test