Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
CrowdProcess Job Client
JavaScript
Failed to load latest commit information.
lib
.gitignore add Gruntfile, gitignore bundle
README.md install outside of javascipr
config.js even less files
index.js do not throw when there's no authentication
package.json even less files

README.md

CrowdProcess Job Client

Basic CRUD for CrowdProcess Jobs

Getting it

$ # install it with
$ npm install --save crp-job-client
// require it
var Client = require('crp-account-client');

// initiallize it with a username and password
var jobs = Client({
  email: 'my@email.com',
  password: 'a safe password'
});

// Or with a token
var jobs = Client({
  token: 'bb74a721-1728-45fe-8394-2d3ef4e0ac82'
});

You can get your authentication tokens with the account client.

Create a Job

var job = {
  program: "function Run (d) { return 3*d; }"
};

var jobId; // we'll use this on the next code block
jobs.create(job, function (err, res) {
  if (err)
    return console.log('not found :(');

  jobId = res.id;
});

View the job

// remember jobId from the last code block ?
jobs(jobId).show(function (err, job) {
  if (err)
    return console.log('not found :(');

  console.log(job);
});

List all the jobs

jobs.list(function (err, jobList) {
  if (err)
    return console.log('Something went terribly wrong');

  console.log(jobList); // it's an array of objects just like the one you got on jobs(jobId).show()
});

Delete a job

jobs(jobId).destroy(function (err) {
  if (err)
    console.log('cannot find the job');
});

Delete all your jobs

jobs.purge(function (err) {
  if (err)
    console.log('something went terribly wrong');
});
Something went wrong with that request. Please try again.