-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2f81835
Showing
39 changed files
with
35,475 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 NEC Corporation of America | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<h1 align="center"> | ||
<a href="https://developer.univerge.blue/"> | ||
<img alt="UNIVERGE BLUE" title="UNIVERGE BLUE" src="https://developer.univerge.blue/assets/images/logo-beta.svg" width="450"> | ||
</a> | ||
</h1> | ||
|
||
# JavaScript sample code for UNIVERGE BLUE® EXTEND API | ||
|
||
This sample code shows how to work with <a href="https://developer.univerge.blue/index.html">UNIVERGE BLUE® EXTEND API</a>. | ||
|
||
The UNIVERGE BLUE® EXTEND API allows you to integrate the features of UNIVERGE BLUE®'s award-winning voice, video, contact center, and analytics services into business applications (CRMs, ERPs, Ticketing Systems, etc.). | ||
|
||
## Authorization | ||
|
||
You are going to need a set of valid credentials to invoke the APIs. Please follow the instructions provided in the [UNIVERGE BLUE® EXTEND API page](https://kb.univerge.blue/en-US/Article/63780) to register your service account and your application Client ID. | ||
|
||
> NOTE: You need the Account Owner, or Technical Administrator with CONNECT or MEET permissions to access the Extend API section of **Control Panel**. If you do not have the sufficient permissions, please contact your account administrator for help. | ||
Please review the [Authorization API reference](https://developer.univerge.blue/api/spec/calling/index.html#dev-guide-auth-guide) for detailed information about supported authorization flows and credentials. | ||
|
||
## Hosting the code | ||
|
||
To use the provided samples, you would need to host the repository on some website (because you need a unique client URL for proper authorization configuration). There are multiple options how to achieve this, but the simplest ones are: | ||
|
||
* **Option 1**: [Fork](https://github.com/univerge-blue/extend-api-samples/fork) the repository into your own account, and [enable the GitHub pages](https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site) for it. | ||
* **Option 2**: Self-host the code. Clone our repository and use your favorite http server (nginx, apache, IIS, etc). | ||
|
||
## Invoking the APIs | ||
|
||
* Browse the **index.html** file to configure and authorize your client. | ||
* After the successful authorization you will see the menu with the available API call samples. | ||
|
||
## Credits | ||
|
||
This code sample uses [**OIDC client**](https://github.com/IdentityModel/oidc-client-js) - a library for providing OpenID Connect (OIDC) and OAuth2 protocol support for client-side, browser-based JavaScript client applications. | ||
|
||
## License | ||
|
||
This code sample is licensed under [MIT License](https://github.com/univerge-blue/extend-api-samples/blob/main/LICENSE). | ||
|
||
## Feedback | ||
|
||
Excited? Frustrated? Please feel free to contact us via the [feedback form](https://developer.univerge.blue/articles/feedback.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const baseUrl = 'https://api.univerge.blue'; | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts | ||
function getContacts(query, phone, scope, fields){ | ||
let url = `${baseUrl}/address-book/v3/contacts`; | ||
|
||
let searchParams = new URLSearchParams(); | ||
if(query) searchParams.append("query", query); | ||
if(phone) searchParams.append("phone", phone); | ||
if(scope) searchParams.append("scope", scope); | ||
if(fields) searchParams.append("fields", fields); | ||
|
||
if(searchParams.toString()){ | ||
url += `?${searchParams.toString()}`; | ||
} | ||
|
||
return makeRequest("GET", url).then((response) => response.json()); | ||
} | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts/_me | ||
function getUserDetails(fields){ | ||
let url = `${baseUrl}/address-book/v3/contacts/_me`; | ||
|
||
if(fields){ | ||
url += `?${fields}`; | ||
} | ||
|
||
return makeRequest("GET", url).then((response) => response.json()); | ||
} | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#post-/address-book/v3/contacts/_search | ||
function getContactsByJIDs(jids, fields){ | ||
let url = `${baseUrl}/address-book/v3/contacts/_search`; | ||
|
||
if(fields){ | ||
url += `?${fields}`; | ||
} | ||
|
||
const body = { | ||
"jids" : jids | ||
} | ||
|
||
return makeRequest("POST", url, body).then((response) => response.json()); | ||
} | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts/{id} | ||
function getSingleContact(id, fields){ | ||
let url = `${baseUrl}/address-book/v3/contacts/${id}`; | ||
|
||
if(fields){ | ||
url += `?${fields}`; | ||
} | ||
|
||
return makeRequest("GET", url).then((response) => response.json()); | ||
} | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/avatars/{avatarId} | ||
function getAvatar(avatarId){ | ||
const url = `${baseUrl}/address-book/v3/avatars/${avatarId}`; | ||
|
||
return makeRequest('GET', url).then((response) => response.json()); | ||
} | ||
|
||
// https://developer.univerge.blue/api/spec/address_book/index.html#post-/address-book/v3/avatars/_search | ||
function getMultipleAvatars(avatarIds){ | ||
const url = `${baseUrl}/address-book/v3/avatars/_search`; | ||
const body = { | ||
"avatarIds": avatarIds, | ||
}; | ||
return makeRequest('POST', url, body).then((response) => response.json()); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Address book samples</title> | ||
<link rel='stylesheet' href='../../assets/styles/styles.css'> | ||
<body> | ||
<div id="nav-bar"> | ||
<input id="logout" type="button" value="Logout"> | ||
<a href="../../auth/pkce/api-menu.html"> Back to API menu </a> | ||
</div> | ||
|
||
<div class="content"> | ||
<div> | ||
<section> | ||
<h2>Address Book API</h2> | ||
<p>The Address Book API is a central point for any contact that is available to the user. | ||
The contact can represent either person's details such as name, phone number or job title, | ||
or a shared object with the phone number or e-mail address such as a Virtual Extension | ||
or Resource Mailbox. | ||
</p> | ||
<div> | ||
<button id='getContacts'>Get Contacts</button> | ||
<details> | ||
<summary>Optional settings | ||
<a href='https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts'>Guide</a> | ||
</summary> | ||
<div> | ||
<input id="query" placeholder="query"></input> | ||
</div> | ||
<div> | ||
<input id="phone" placeholder="phone"></input> | ||
</div> | ||
<div> scope | ||
<select id="scope"> | ||
<option value="0">0</option> | ||
<option value="1">1</option> | ||
</select> | ||
</div> | ||
<div> | ||
<h3>fields:</h3> | ||
<div> | ||
<label for="horns">id</label> | ||
<input type="checkbox" id="getContactsid" value="id"></input> | ||
</div> | ||
<div> | ||
<label for="horns">_all</label> | ||
<input type="checkbox" id="getContacts_all" value="_all"> | ||
</div> | ||
<div> | ||
<label for="horns">legacyId</label> | ||
<input type="checkbox" id="getContactslegacyId" value="legacyId" disabled> | ||
<div class="tooltip">Help | ||
<span class="tooltiptext">legacyId value should be accompanied with _all or id</span> | ||
</div> | ||
</div> | ||
</div> | ||
</details> | ||
</div> | ||
<div> | ||
<button id='getUserDetails'>Get User Details</button> | ||
<details> | ||
<summary>Optional settings | ||
<a href='https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts/_me'>Guide</a> | ||
</summary> | ||
<div> | ||
<h3>fields:</h3> | ||
<div> | ||
<label for="horns">id</label> | ||
<input type="checkbox" id="getUserDetailsid" value="id" placeholder="fields"></input> | ||
</div> | ||
<div> | ||
<label for="horns">_all</label> | ||
<input type="checkbox" id="getUserDetails_all" value="_all"> | ||
</div> | ||
<div> | ||
<label for="horns">legacyId</label> | ||
<input type="checkbox" id="getUserDetailslegacyId" value="legacyId" disabled> | ||
<div class="tooltip">Help | ||
<span class="tooltiptext">legacyId value should be accompanied with _all or id</span> | ||
</div> | ||
</div> | ||
</div> | ||
</details> | ||
</div> | ||
<div> | ||
<button id='getContactsByJIDs'>Get contacts by JIDs</button> | ||
<input id="jids" placeholder="jids"></input> | ||
<details> | ||
<summary>Optional settings | ||
<a href='https://developer.univerge.blue/api/spec/address_book/index.html#post-/address-book/v3/contacts/_search'>Guide</a> | ||
</summary> | ||
<div> | ||
<h3>fields:</h3> | ||
<div> | ||
<label for="horns">id</label> | ||
<input type="checkbox" id="getContactsByJIDsid" value="id" placeholder="fields"></input> | ||
</div> | ||
<div> | ||
<label for="horns">_all</label> | ||
<input type="checkbox" id="getContactsByJIDs_all" value="_all"> | ||
</div> | ||
<div> | ||
<label for="horns">legacyId</label> | ||
<input type="checkbox" id="getContactsByJIDslegacyId" value="legacyId" disabled> | ||
<div class="tooltip">Help | ||
<span class="tooltiptext">legacyId value should be accompanied with _all or id</span> | ||
</div> | ||
</div> | ||
</div> | ||
</details> | ||
</div> | ||
<div> | ||
<button id='getSingleContact'>Get single contact</button> | ||
<input id="id" placeholder="id"></input> | ||
<details> | ||
<summary>Optional settings | ||
<a href='https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/contacts/{id}'>Guide</a> | ||
</summary> | ||
<div> | ||
<h3>fields</h3> | ||
<div> | ||
<label for="horns">id</label> | ||
<input type="checkbox" id="getSingleContactid" value="id" placeholder="fields"></input> | ||
</div> | ||
<div> | ||
<label for="horns">_all</label> | ||
<input type="checkbox" id="getSingleContact_all" value="_all"> | ||
</div> | ||
<div> | ||
<label for="horns">legacyId</label> | ||
<input type="checkbox" id="getSingleContactlegacyId" value="legacyId" disabled> | ||
<div class="tooltip">Help | ||
<span class="tooltiptext">legacyId value should be accompanied with _all or id</span> | ||
</div> | ||
</div> | ||
</div> | ||
</details> | ||
</div> | ||
</section> | ||
<div> | ||
<h3>Output: </h3> | ||
<button id='clearLog'>Clear</button> | ||
<pre id='out'></pre> | ||
</div> | ||
</div> | ||
<section id="avatars-section"> | ||
<h2>Avatars</h2> | ||
|
||
<div class="block"> | ||
<div class="text-info"> | ||
To get avatar, copy the ID of the required avatar from 'Get contacts' response into the field below: | ||
</div> | ||
<input id='avatar-id' type="text" placeholder="avatar id" size="40"> | ||
<button id='get-avatar'>Get avatar</button> | ||
<a class="link-to-guide" | ||
href="https://developer.univerge.blue/api/spec/address_book/index.html#get-/address-book/v3/avatars/{avatarId}" | ||
target="_blank">Get avatar guide</a> | ||
<div id="get-avatar-output"></div> | ||
</div> | ||
|
||
<div class="block"> | ||
<div class="text-info"> | ||
To get an array of avatar, copy the IDs of the required avatars from 'Get contacts' response into the field below, separated by commas: | ||
</div> | ||
<input id='avatar-ids' type="text" placeholder="avatar ids" size="80"> | ||
<button id='get-multiple-avatars'>Get multiple avatars</button> | ||
<a class="link-to-guide" | ||
href="https://developer.univerge.blue/api/spec/address_book/index.html#post-/address-book/v3/avatars/_search" | ||
target="_blank">Get multiple avatars guide</a> | ||
<div id="get-multiple-avatars-output"></div> | ||
</div> | ||
</section> | ||
</div> | ||
|
||
<script src='../../assets/jwt-decode.js'></script> | ||
<script src='../../assets/log.js'></script> | ||
<script src='../../assets/pkce-auth-session-manager.js'></script> | ||
<script src='../../assets/make-request-factory.js'></script> | ||
<script src='address-book-api.js'></script> | ||
<script src='assets/address-book.js'></script> | ||
</body> | ||
</html> | ||
|
Oops, something went wrong.