Skip to content

A limesurvey node.js client (with promise)

License

Notifications You must be signed in to change notification settings

sumcumo/node-limesurvey

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-limesurvey

A limesurvey node.js client (with promise)

Usage

<!> Do not forget to activate the LimeSurvey API first! To do this, access your global configuration, click on Interfaces and enable the API setting (JSON-RPC). <!>

More info : https://manual.limesurvey.org/RemoteControl_2_API

Code example

var fs = require('fs')

var limesurvey = require('node-limesurvey')({
    url: 'https://xxxxxxxx/index.php/admin/remotecontrol',
    username: 'xxxxx',
    password: 'xxxxx'
})


var start = async() => {

    // NOT MANDATORY - LIB AUTO (RE)GENERATE TOKEN IF NEEDED
    // let token = await limesurvey.getToken()
    // console.log('token', token)

    let surveys = await limesurvey.getSurveyList()
    console.log('surveys=', surveys)

    let survey = await limesurvey.getSurveyInfo('37436')
    console.log('survey=', survey)

    let questions = await limesurvey.getQuestions('37436')
    console.log('questions', questions)

    let groups = await limesurvey.getGroups('37436')
    console.log('groups', groups)

    let responses1 = await limesurvey.getResponsesBySurveyId('37436')
    console.log(responses1)

    let responses2 = await limesurvey.getResponsesByToken('37436', 'nKSAOM6JBYBDs2Q')
    console.log(responses2)

    let prettyResponses = await limesurvey.getPrettyResponses('37436')
    console.log(JSON.stringify(prettyResponses, null, 3))

    let content = await limesurvey.getStatistics('37436', 'xls')
    // fs.writeFile('/docs/stat.xls', content)

}

start()

Debug

This lib use https://www.npmjs.com/package/debug

DEBUG=* node example.js DEBUG=limesurvey node example.js

About

A limesurvey node.js client (with promise)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%