An API, or Application Programming Interface, is a crucial component in modern software development that acts as a bridge between different software applications or services.
It defines a set of rules, protocols, and tools that enable these applications to communicate and interact with each other seamlessly.
APIs allow developers to access specific functionalities or data from another application, service, or platform without needing to understand the underlying complex code.
They provide a standardized way for developers to integrate features from various sources into their own applications, speeding up development, enhancing functionality, and fostering interoperability.
APIs are used across a wide range of industries and technologies, from web development and mobile apps to cloud computing and IoT devices, playing a pivotal role in shaping the interconnected digital landscape of today's world.
This is an API reference for employee reports. An API, which stands for Application Programming Interface, is like a tool that lets different computer programs talk to each other.
In this case, the API helps developers access and work with employee reports in a way that's easy and consistent
https://api.whereismystaff.com/v1/my-employees
POST
JSON
ApiKey
None
This example demonstrates making a POST request to the API via PHP:
<?php
// API Endpoint URL
$apiUrl = "https://api.whereismystaff.com/v1/my-employees";
// API Key
$apiKey = "123456"; // replace with your real API key
// Create a new cURL resource
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
// Set Here Your Requesred Headers
'apiKey:'.$apiKey,
"accept: */*",
"content-type: application/json",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r($response);
}
?>
This example demonstrates making a POST request to the API via JavaScript:
<script>
async function makeApiRequest() {
const apiUrl = "https://api.whereismystaff.com/v1/my-employees"; // API endpoint URL
// create date with javaScript
const response = await fetch(apiUrl,{
method: "POST",
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
"apiKey": "123456",// replace with your real apikey
},
});
const responseData = await response.json();
displayApiResponse(responseData);
}
function displayApiResponse(data) {
const responseContainer = document.getElementById("response");
}
This API will provide you with the working hours of employees. When you make a request to this API, it will return data containing information about the hours that employees have worked. This can include details such as the start and end times of their work shifts, allowing you to monitor and manage employee attendance and productivity.
By utilizing this API, you can efficiently access and analyze working hours data, helping you make informed decisions and optimize your workforce management strategies.
https://api.whereismystaff.com/v1/working-hours
POST
JSON
ApiKey
startDate (formate 2023-08-01)
&& endDate (formate 2023-08-01)
This example demonstrates making a POST request to the API via PHP:
<?php
// API Endpoint URL
$apiUrl = "https://api.whereismystaff.com/v1/working-hours";
// API Key
$apiKey = "123456"; // your API key
// Create a new cURL resource
$curl = curl_init();
$today = date("d-m-Y");
$postData = array(
'startDate' => $today,
'endDate' => date("d-m-Y", strtotime("$today -1 month"))
);
// Convert data to JSON format
$jsonData = json_encode($postData);
curl_setopt_array($curl, array(
CURLOPT_URL => $apiUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_TIMEOUT => 30000,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>$jsonData
CURLOPT_HTTPHEADER => array(
// Set Here Your Requesred Headers
'apiKey:'.$apiKey,
"accept: */*",
"content-type: application/json",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r($response);
}
?>
This example demonstrates making a POST request to the API via JavaScript:
<script>
async function makeApiRequest() {
const apiUrl = "https://api.whereismystaff.com/v1/working-hours"; // API endpoint URL
// create date with javaScript
let dateObj = new Date();
let month = dateObj.getUTCMonth() + 1; //months from 1-12
let day = dateObj.getUTCDate();
let year = dateObj.getUTCFullYear();
let newDate = year + "/" + month + "/" + day;
let BeforeMonth = month -1;
let dateBeforeMonth = year + "/" + BeforeMonth + "/" + day;
let data = {
'startDate':dateBeforeMonth,
'endDate':newDate
}
const response = await fetch(apiUrl,{
method: "POST", // *GET, POST, PUT, DELETE, etc.
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
"apiKey": "123456",// replace with your real apikey
},
body: JSON.stringify(data),
});
const responseData = await response.json();
displayApiResponse(responseData);
}
function displayApiResponse(data) {
const responseContainer = document.getElementById("response");
responseContainer.innerHTML = "" + JSON.stringify(data, null, 2) + "
";
}