Availability
Get or create/update the a user's availability
Please note that in all urls & code samples you'll need to replace:username
and :corporation
with appropriate values
Get Availability
GET
/v2/organization/:corporation/expert/:username/availability
Headers
Url
Response
{
data: [
{
availability_keynote: 1,
availability_moderator: 1,
availability_panelist: 1,
availability_workshop: 1,
availability_host_mc: 1,
availability_appearance: 1,
availability_corptraining: 1
}
],
success: true
}
Code
const accessToken = `<ACCESS TOKEN>`
fetch('https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability', {
method: 'GET',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Bearer ${accessToken}`
}
})
.then(response => response.json())
.then(json => {
const { success, data } = json
if (success) {
const availability = data[0]
console.log('availability', availability)
}
})
.catch(error => console.error(error));
$accessToken = urlencode('<ACCESS TOKEN>');
$url = 'https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability';
$ch = curl_init($url);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array('Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer ' . $accessToken)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$json = json_decode($response);
if($json->success){
echo $json->data[0]->availability;
}
curl_close($ch);
curl https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS TOKEN>"
Update Availability
POST
/v2/organization/:corporation/expert/:username/availability
Headers
Url
Body
Response
{
data: {
id: null
},
success: true
}
Code
const data = new URLSearchParams();
const accessToken = `<ACCESS TOKEN>`
data.append('availability_keynote', 1)
data.append('availability_moderator', 1)
data.append('availability_panelist', 1)
data.append('availability_workshop', 1)
data.append('availability_host_mc', 1)
data.append('availability_appearance', 1)
data.append('availability_corptraining', 1)
fetch('https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Bearer ${accessToken}`
},
body: data
})
.then(response => response.json())
.then(json => {
const { success, data } = json
})
.catch(error => console.error(error));
$accessToken = urlencode('<ACCESS TOKEN>');
$url = 'https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability';
$data = ['availability_keynote' => 1,
'availability_moderator' => 1,
'availability_panelist' => 1,
'availability_workshop' => 1,
'availability_host_mc' => 1,
'availability_appearance' => 1,
'availability_corptraining' => 1];
$ch = curl_init($url);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array('Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer ' . $accessToken)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
$json = json_decode($response);
if($json->success){
var_dump($json->data);
}
curl_close($ch);
curl -X POST https://public-api.expertfile.com/v2/organization/:corporation/expert/:username/availability \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS TOKEN>" \
-d '{"availability_keynote": 1, "availability_moderator": 1, "availability_panelist": 1, "availability_workshop": 1, "availability_host_mc": 1, "availability_appearance": 1, "availability_corptraining": 1}'
Last updated