JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q45884F

Library for performing API calls to Samanage Helpdesk Service

Package Exports

  • samanage-api

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (samanage-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

samanage-api

This is my personal helper code for performing API calls to Samanage Helpdesk Service. The code is provided as-is, without any warrenty. It is a work in progress and may not support all the options offered by the Samanage API Feel free to contact me with requests, issues or questions.

Installation

npm install samanage-api

Making a call

var SamanageAPI = require('samanage-api')
var connection = SamanageAPI.connection(process.env.TOKEN)
var request = ...
var success = function(data) {...}
var failure = function(error) {...}
SamanageAPI.callSamanageAPI(connection, request, success, failure)

Retrieval with filters

var get_incidents = SamanageAPI.get('incident')
var request = get_incidents(
  new SamanageAPI.Filters().add({
    sort_order: 'ASC',
    sort_by: 'created_at',
    created: ['2018-01-01','2018-01-02']
  })
)
SamanageAPI.callSamanageAPI(...)

Building filters

var get_incidents = SamanageAPI.get('incident')
var filters = new SamanageAPI.Filters().
  sort_by('name').
  sort_order(SamanageAPI.Filter.DESC).
  between_dates('created','2018-01-01','2018-01-02').
  per_page(100).
  page(3)
var request = get_incidents(filters)

Update

var request = SamanageAPI.update('incident')(3, {
  name:'opened with samanage-api-js library'
})

Create

var request = SamanageAPI.create('incident')({
  name:'opened with samanage-api-js library'
})