Here’s a quick rundown on how to get started using the Velpic API.

  1. Generate an API key
  2. Using your API key
  3. Example Request – Get list of trainees

Generate an API Key

If you wish to use our public REST API to integrate with Velpic, you will need an API Access Key to use in a header for authentication. To generate one, please follow these steps.

  1. First select the Integrations view on the left navigation of the Manage section.
  2. This will open up the integrations section in your main panel. The options you see may differ according to your subscription level.
  3. Click API Access Keys that and you will see this view. On your first visit, you will not have an API Key yet.
  4. Click on Generate API Key and the system will generate your first API Key. Keep this value secret, it is the value which authenticates your account when calling our REST api.

Once you have your key, you can continue to use it for as long as you like. We do not apply any time restriction for its duration of usage.

Regenerating your API key in Velpic

If you wish to cycle it due to security concerns, etc, the click on the Regenerate API Key button. This will inactivate your current key and issue you a new one. Please keep in mind that this will break any integrations that you have written that are using the previous value. You can only have one active API Key at a time.

Using your API key

Your access key is an alpha-numeric string that must be attached in the header of all requests as AccessKey. This key is secret and should be treated like a password. For example, in Node.js the header would have to include

"accesskey": "[ACCESS_KEY]"

Example Request – Get a list of trainees

Using cURL on Linux, Mac or Windows

Install cURL from https://curl.haxx.se/download.html then run the following command

curl -X GET -H "AccessKey: [ACCESS_KEY]" -H "Content-Type: application/json" "https://app.velpic.com/api/v2/user/?roleId=3"

Results

This should return a set of JSON objects, similar to the following.

{ 
results: 
[ 
  { 
    userName: 'smithjohn',
    firstName: 'John',
    lastName: 'Smith',
    emailAddress: 'jsmith@yourorganisation.com',
    mobileNumber: '0412 345 678',
    phoneNumber: '94123456',
    lastLoggedInDate: '2016-09-05T06:45:53.000Z',
    active: true,
    employeeNumber: '',
    clientStatusId: 56,
    groups: [Object],
    groupsSupervised: [],
    roles: [Object],
    clientId: 76,
    timeZone: 'Australia/Perth',
    id: 12345,
    createdDate: '2015-11-19T05:04:43.000Z',
    modifiedDate: '2016-09-05T06:45:53.000Z' 
  },
  { 
    userName: 'katepostman',
    firstName: 'Kate',
    lastName: 'Postman',
    emailAddress: 'kpostman@yourorganisation.com',
    mobileNumber: '0498 765 432',
    phoneNumber: '61524567',
    lastLoggedInDate: '2016-09-05T04:42:49.000Z',
    active: true,
    employeeNumber: '',
    clientStatusId: 56,
    groups: [Object],
    groupsSupervised: [],
    roles: [Object],
    clientId: 76,
    timeZone: 'Australia/Perth',
    id: 98765,
    createdDate: '2015-11-19T08:03:51.000Z',
    modifiedDate: '2016-09-05T04:42:49.000Z' 
  } 
],
meta: 
  {
    totalResultCount: 2,
    startIndex: 0,
    endIndex: 2,
    createdDate: '2016-09-05T07:38:00.550Z',
    modifiedDate: '2016-09-05T07:38:00.550Z'
  },
  createdDate: '2016-09-05T07:38:00.550Z',
  modifiedDate: '2016-09-05T07:38:00.550Z'
}

Using Node.js

Install Node.js

Download and install Node.js from https://nodejs.org/en/download/

Create a JavaScript file

Create a file called GetTrainees.js and open it. In the file add the following code, replacing [ACCESS_KEY] with your access key:

var http = require("https");

var options = {
 "method": "GET",
 "hostname": "app.velpic.com",
 "port": null,
 "path": "/api/v2/user/?roleId=6&maxResults=100",
 "headers": {
 "accesskey": "[ACCESS_KEY]",
 "content-type": "application/json"
 }
};

var req = http.request(options, function (res) {
 var chunks = [];

 res.on("data", function (chunk) {
 chunks.push(chunk);
 });

 res.on("end", function () {
 var body = JSON.parse(Buffer.concat(chunks));
 console.dir(body);
 });
});

req.end();

This will return a set of users who are Trainees.

Running the request

In your terminal, navigate to the folder you saved GetTrainees.js in and then enter the command.

node GetTrainees.js