API for Product 2004
Your developers can use this API to query time hours data from your account in product 2004.
1. Query Time Cards data:
Sample Code for passing parameters in URL:
https://api1.opentimeclock.com/Jun-Inside-VPC?cmd=api/v2004QueryTimeCards&companyId=xxxx&developerToken=xxxx&nextRecord=0&dateTimeFrom=2022-05-01 00:00:00&dateTimeTo=2022-05-15 23:59:59&userFullName=xxxx&departmentName=xxxxSample Code in JavaScript with jQuery POST:
function post(data, handler) {
var url = "https://api1.opentimeclock.com/Jun-Inside-VPC"; //api url
$.post(url, JSON.stringify(data), handler, 'json');
}
function getTimeCards() {
//pass in JSON parameters:
post({
"cmd": "api/v2004QueryTimeCards", //This passed in commmand means query time cards records. We may have add or modify command later.
"companyId": "xxxx", //Find your "Company ID" in company setting page.
"developerToken": "xxxx", //Find "Developer Token" in reports page with admin account
"nextRecord": "0", //Default to "0". If >"0" means query the left data when there are more than 5k records available.
"dateTimeFrom": "2022-05-01 00:00:00", //From Date Time format: 0000-00-00 00:00:00
"dateTimeTo": "2022-05-15 23:59:59", //To Date Time format: 0000-00-00 00:00:00
"userFullName": "xxxx", //sample: Elon Musk; For all users, use "ALL USERS" or ""
"departmentName": "xxxx" //sample: HR Department; For all departments, use "ALL DEPARTMENTS",or ""
}, function (result) {
//sample code to use returned data:
var statusCode = result.statusCode;
var message = result.message;
var nextRecord = result.nextRecord;
var dataSet = result.data;
if(statusCode == 'SUCCESS')
console.log('query data successfully.');
if(statusCode == 'ERROR')
console.log('query data failed. check returned message.');
if(nextRecord == '-1')
console.log('no more data left');
if(nextRecord != '-1')
console.log('there are more data left. pass in nextRecord to query more.');
//use data set like this:
var firstFullName=dataSet[0].userFullName;
});
}
Sample Code in PHP:
Sample returned data in JSON:
Where to find Developer Token:

Last updated
Was this helpful?