1.0.2 • Published 6 years ago

timewax-v2 v1.0.2

Weekly downloads
2
License
UNLICENSED
Repository
-
Last release
6 years ago

Timewax API

Dependencies

Node >= 0.12

API

timewax.init(options)

Initialize the options first by supplying an options hash with the following:

optionsTypeExample
endpointString'https://api.timewax.com'
clientString
usernameString
passwordString

Usage

    var timewax = require('timewax');

    // obj to hold params for API requests
    var params = {};

    timewax.init({
      endpoint: 'https://api.timewax.com',
      client: 'MyClientName',
      username: 'U123',
      password: 'itsasecret'
    });

timewax.request(service, payload, xpathFilter, callback)

This is the generic POST request to interact with the API and can be used when a convenience method is not yet available.

argumentsTypeExample
serviceString'/resource/list/''
paramsHash{ token: 'ASDFASFSADFASDFASF' }
Must include a token property
xpathFilterString'//resources'
callbackfunction(err, result)NodeJS style callback as last parameter

Convenience Methods

timewax.getAuthenticationToken(callback)

Returns valid API token which lasts for 60 minutes and carries security of the user who requested the token.

Usage

    // get a reusable API token
    timewax.getAuthenticationToken(function(err, token) {

      // cache the token on the params obj
      params.token = token

      });

timewax.resourceList(params, callback)

Returns an array of resources for given Client group in original token request.

FieldDescription
resourceIDThe unique ID of the resource.
codeResource code.
fullNameFull name
lastNameLast name
firstNamesFirst names
infixInfix
colorResource color (hexadecimal value)

Usage

    // get full list of resources as a array
    timewax.resourceList(params, function(err, resources) {

      // do something with my resources
    });

timewax.getResource(params, callback)

Returns a full resource object. Params are:

ParamsDescription
resourceName fullName or email

timewax.projectList(params, callback)

Returns an array of project objects like:

FieldDescription
codeProject code
nameProject name
shortNameProject short name

To get the full Project Object like below, do a subsequent call to timewax.getProject:

FieldDescription
validIndication that service was not executed successfully
codeProject code
nameProject name
shortNameProject short name
useInvoicingyes or no. Is it possible to invoice from this project?
chargeableyes or no. Is this project chargeable?
approveTimeyes or no. Do submitted hours need to be approved?
approveExpensesyes or no. Do submitted expenses need to be approved?
approveCalenderEntriesyes or no. Can calendar entries beapproved?
orgUnitManagerIsApproveryes or no.
blockEntriesyes or no. Blocks making bookings on the proejct
isTemplateyes or no. Can this project be used as a template for new projects?
isActiveyes or no. Is the project active?
startDateyyyymmdd. Start date of the project
endDateyyyymmdd. End dat of the project
notesRemarks
companyThe company/customer name for this project
organisationalUnitName. The organizational unit where the project belongs
projectManagerName. Project manager of the project (Resource)
currencyProject currency
parentProjectName. The parent project (Project)
statusProject status (Attributes)
colorProject color (hexadecimal value)
externalLinkFilesURL to an online file location
statusstatus (Attribute)
invoice/blockInvoiceyes or no. Block invoices for this project?
invoice/backupResponsibleName. Who is also allowed to start the invoice run
invoice/debtor/name, address, postcode, city, country, debtorNumber and emailAdres of the debtor (company, debtor role)
invoice/invoiceLayoutName. Invoice lay-out for the invoice
invoice/invoiceLayoutCreditnoteName. Invoice lay-out for the credit note
invoice/invoicetypeHoursType hours (Attributes)
invoice/invoicetypeKMyes or no. Do kilometers have to be invoiced?
invoice/invoicetypeKMRateRate per kilometer
invoice/invoicetypeExpensesyes or no. Do expenses have to be invoiced?
invoice/VATSalesHoursName. What VAT percentage to apply for hours.
invoice/VATSalesExpensesName. What VAT percentage to apply for expenses.
invoice/reference1Invoice reference 1
invoice/reference2Invoice reference 2
invoice/reference3Invoice reference 3
invoice/reference4Invoice reference 4
invoice/reference5Invoice reference 5
categories/alignmentName. Attribute
categories/riskName. Attribute
categories/locationName. Attribute
categories/complexityName. Attribute
categories/knowledgeAvailibleName. Attribute
categories/budgetName. Attribute
categories/businessTypeName. Attribute
categories/durationName. Attribute
categories/financialRiskName. Attribute
categories/decisionLevelName. Attribute
categories/benefitsName. Attribute
categories/politicalSensitivityName. Attribute
categories/productCategoryName. Attribute
categories/innovationName. Attribute
categories/portfolioAdviseName. Attribute
categories/priorityName. Attribute

timewax.projectListChanged

Returns list of projects that were created or modified during a time period; params is a hash with:

ParamTypeExample
dateToString'20160101' - yyymmdd
dateFromString'20170101' - yyyymmdd

Returns an array of project objects like:

FieldDescription
codeProject code
nameProject name
shortNameProject short name

To get the full Project Object, do a subsequent call to timewax.getProject:

Usage

    var params = {
      dateFrom: '20160101',
      dateTo: '20160201'
    };
    // get full list of projects
    timewax.projectListChanged(params, function(err, projects){

      // do something with my projects
    });

timewax.getProjectBudget(params, callback)

Returns an array of breakdowns within a project with their budgets; params above is a hash of:

ParamTypeExample
projectString'Internal' - can be code or name

Usage

    // add any other filters or parameters the service requires

    params.project = "myProjectCode" // can be TimeWax project name or code

    timewax.getProjectBudget(params, function(err, breakdowns){

      // do something with my budgets
    });

timewax.breakdownList(params, callback)

Returns an array of breakdowns within a project; params above is a hash of:

ParamTypeExample
projectString'Internal' - can be code or name

Usage

    // add any other filters or parameters the service requires

    params.project = "myProjectCode" // can be TimeWax project name or code

    timewax.breakdownList(params, function(err, breakdowns){

      // do something with my breakdowns
    });

timewax.entriesList(params, callback)

Returns full list of time entries for a resource; params is a hash with:

ParamTypeExample
resourceString'089' - resource API ID
dateToString'20160101' - yyymmdd
dateFromString'20170101' - yyyymmdd
projectString'089' - name or code
onlyApprovedEntiresBoolTRUE

Entry Objects returned:

FieldDescription
idThe unique id of the time line
dateThe date of the booking.
resourceResource name
resourceCodeResource code
projectThe project name of the booking.
projectCodeThe project code of the booking.
breakdownThe breakdown name of the booking.
breakdownCodeThe breakdown code of the booking.
breakdownParentThe name of the parent breakdown.
breakdownParentCodeThe code of the parent breakdown.
statusThe status of the booking.
dateUpdateStatusThe last update of the line (approved or rejected)
typevalue from the field type.
referenceValue in the reference field.
timeFromStarting time of the booking. Format: hh:mm.
timeToEnd time for the booking. Format: hh:mm.
hoursNumber of hours.
descriptionDescription.
KMNumber of kilometers.
descriptionKMDescription of the kilometers.
rejectionRemarksRemarks in case the booking has been rejected in approval
invoiceStatusHas the line been invoiced?
addDateThe add date of the line
modifyDateThe modification date of the line

Usage

    params.dateFrom = "20160101" // Format: yyyymmdd
    params.dateTo = "20160601"  // Format: yyyymmdd
    params.resource = "089"     // API ID from TimeWax for resource
    params.project = "Build Phase One"      // Code or name
    params.onlyApprovedEntires = true // a boolean

    timewax.entriesList(params, function(err, entries){

      // do something with my time entries
    });

timewax.addTimeEntry(params, callback)

Returns a success or failure; params is a hash with:

ParamTypeExample
resourceString'089' - resource API ID
dateString'20160101' - yyymmdd
projectString'CODEORNAME'
breakdownString'089' - name or code
hoursString'7.5'
startTimeString'09:00' - hh:mm
endTimeString'10:00' - hh:mm
referenceString'KJM'
descriptionString'Getting Details for Login'
typeString'PLANNING'

timewax.entriesListChanged(params, callback)

Returns full list of entries added/modified/deleted within a given period; params above is a hash of:

ParamTypeExample
resource(optional)String'089' - resource API ID
dateToString'20160101' - yyymmdd
dateFromString'20170101' - yyyymmdd
onlyApprovedEntires (optional)BoolTRUE

If the returned Entry Object contains one of the following:

  • a addDate: it indicates when it was added
  • a modifyDate: it indicates when it was last modified
  • a deleteDate: it indicates when it was deleted

timewax.projectPlanningList(params, callback)

Returns project breakdown details into a Gannt chart structured data; params above is a hash of:

ParamTypeExample
projectString'089' - code or name
versionString'NEWESTV2' - planning version

This service returns an array of objects like:

FieldDescription
projectName of the project
projectCodeProject code
breakdownbreakdown name
breakdownCodebreakdown code
versionbreakdown name
startdateStart date for this plan line
enddateEnd date for this plan line
durationDuration in days
commentsAdditional comment
estimateEstimate number of days
labelAdditional label