MoeilijkheidsgraadDifficulty: expert
Content
Table of Contents | ||||
---|---|---|---|---|
|
Leerdoelen
Na het lezen van dit artikel zul je in staat zijn om:
begrijpen wat API's voor Workplace kunnen doen
workplace API's testen
API staat voor Application Programming Interface en maakt eenvoudige uitwisseling van gegevens en functionaliteit mogelijk. De Workplace API documentatie (Swagger) is beschikbaar in een apart tabblad in het GO menu.
Hoe krijg ik toegang tot de API van Workplace?
Learning Objectives
After reading this article, you’ll be able to:
understand what Workplace APIs can do
test Workplace APIs
API stands for Application Programming Interface and allows easy exchange of data and functionality. The Workplace API documentation (Swagger) is available in a separate tab in the GO menu.
How to access Workplace API
Go to https://go.cobundu.com/
Inloggen met je gegevens
De optie verschijnt alleen voor gebruikers met een ontwikkelaars- of beheerdersrol. Zie Roles & Profiles voor meer informatie.
Om de API's in je eigen projecten te gebruiken (bijvoorbeeld postman), is het misschien interessant om deLogin with your credentials
The option appears only for users who have a developer or admin role assigned to them. See Roles & Profiles for more information.
To use the APIs in your own projects (eg postman), you might be interested to use the swagger.json-link te gebruiken. Zoals je in de schermafbeelding kunt zien, wordt de "nieuwste" pagina standaard geopend, maar dit kan natuurlijk veranderen.
. As you can see in the screenshot, "latest" page opens per default, but this is of course subject to change.
Note |
---|
Use numbered versions (eg https://go.cobundu.com/rest/v3/docs) om conflicten te vermijden. |
Het gebruik van een specifieke versie heeft het voordeel dat je in de toekomst API-versies kunt vergelijken.
De API testen: voorbeelden
Het is mogelijk om de API van Workplace uit te proberen/te testen. Afhankelijk van het verzoek moet je misschien eerst wat informatie invullen.
to avoid conflicts. |
Using a specific version has the advantage of being able to compare API versions in future.
Note |
---|
For every API method, make sure to chose the latest version Status September 2024
|
Testing the API: examples
It's possible to try out/test the Workplace API. Depending on the request, you might need to fill in some information first.
Below examples mention “location ID”. Selecting a location on https://go.cobundu.com/ wordt de referentie weergegeven, bijvoorbeeld "Vergaderzaal will show the Reference, e.g. "Meeting Room 1". Maar But in de the Workplace back-end van Workplace heeft elke locatie een unieke locatie-, each location has a unique location ID.
Info |
---|
Locatie-Location ID is beschikbaar available in de the Workplace back-end van Workplace https://studio.cobundu.com URL voor elke geselecteerde locatie. |
Bijvoorbeeld de Locatie ID voor verdieping "2e verdieping" in Spacewell Antwerpen is "910000000004545".
Voorbeeld 3. Reserveringen
Om de reserveringen uit je omgeving op te halen, kun je Reservations API > "een lijst met reserveringen ophalen" gebruiken.
Wijzig de datums in de zoekinstructie om (gefilterde) reserveringen te krijgen, elk met de locatie-ID, om zo aan te geven welke locatie is geboekt.
Voer locatie-id's in het zoekfilter in om gefilterde gegevens te krijgen.
Voorbeeld 4. Locatie-informatie opvragen
Een locatie selecteren opfor each selected location. |
For example the Location ID for floor “2nd floor” in Spacewell Antwerp offices is “910000000004545”
Example 3. Reservations
To retrieve the reservations from your environment, you can use Reservations API > "get a list of bookings".
Modify dates in the search instruction and to get (filtered) reservations, each including the location ID, thus indicating which location was booked.
Enter location IDs in the search filter to get filtered data.
Voorbeeld Example 5. PlattegrondOm een plattegrond van de workplace te krijgen, selecteer je Floor plan
To get a Workplace floor plan, select API Locations > "get a location's drawing as SVG".
De gevraagde locatie-ID is in dit geval de verdiepings-
The requested location ID in this case is the floor ID.
"TestenTesting" in swagger geeft een antwoord, maar kan de SVG niet weergeven. Voer de vloerlocatie-ID in de volgende URL in om de SVG te zienwill provide a response, but it cannot show the SVG.
Enter the floor location ID in following URL to see the SVG: https://go.eu1.cloud.cobundu.com/rest/latestv3/locations/vloer locatie floor location ID/tekeningendrawing/svg
Concrete use case: URL
om live plattegrond te tonenStel je voor dat je een URL naar je kioskschermen wilt pushen om live gegevens van de Workplace plattegrond te visualiseren.
Hier stellen we voor om een toegangstoken met een URL op te geven, zodat iedereen met de link de live plattegrond kan zien.
Alternatieve methoden en veelgestelde vragen hierover vind je hierto show live floorplan
Imagine you want to push a URL to your kiosk screens to visualize Workplace live floorplan data.
Here, we suggest to provide an access token with a URL, so that anyone with the link can see the live floorplan.
Alternative methods and Frequently Asked Questions about this can be found here: Workplace live floorplan data visualization
De hieronder voorgestelde speciale methode omvat webauthenticatie The below suggested dedicated method includes web authentication via Rest API. Dit betekent dat een workplace login + wachtwoord nodig zijn, en de API retourneert een JWT token dat kan worden gebruikt om toegang te krijgen tot alle andere API-aanroepen.
Vereisten
Webkiosk moet worden geconfigureerd in Studio
Per verdieping waarvoor je visualisatie wilt instellen, is een Workplace gebruiker nodig:
Minimale rechten op de workplace/geen specifieke rol nodig
rekening houdend met reserveringsfuncties die zijn ingesteld voor deze omgeving
Gebruikersnaam + wachtwoord
Om toegang te krijgen tot API: Workplace gebruiker met een Admin of Developer rol
Oplossing
API gebruiken om sessietoken te krijgen
Ga naar http://go.cobundu.com (gebruiker heeft een beheerders- of ontwikkelaarsrol nodig) > API
Selecteer "auth" > /rest/latestThis means a Workplace login + password are needed, and the API will return a JWT token which can be used to access all other API calls. For an authorization-related action we have the COBUNDU Authorization service. It has public Swagger UI (and swagger.json-link) available at https://login.cobundu.com/rest/v2/docs. You may use the API via Swagger UI or Postman, or any other tool of your choice. This example is based on our Swagger UI.
Note |
---|
For every auth-based API method, make sure to choose the latest version (status September 2024: v2 is the latest, so refer to https://login.cobundu.com/rest/v2/docs) |
Prerequisites
Web kiosk needs to be configured in Studio
Per floor for which you want to set up visualization, a Workplace user is needed:
Workplace minimum rights/no specific role needed
taking into account reservation features set up for this environment
User name + password
To access API: Workplace user with either Admin or Developer role
Solution
Zoek opUsing API to get session token
Go to https://login.cobundu.com/rest/v2/docs (user needs either Admin or Developer role)
httpSelect "auth" > /auth/ssosettings/{loginId} (retourneer sso-instellingen voor de gebruiker)
Geef gebruikersnaam
De respons geeft de hostnaam van de cobundu SSO-instantie die moet worden gebruikt return sso settings for the user)
Provide user name
Response body will provide the host name of COBUNDU Auth instance that needs to be used (Workplace IoT Platform is beschikbaar voor de EU en de VS) (kan bijvoorbeeld available for EU and US) (could be eg "apiUrl" zijn: https://gologin.eu1.cloud.cobundu.com)
Navigate to the apiUrl + /rest/v2/docs from previous step that is https://gologin.eu1.cloud.cobundu.com (gebruiker heeft een beheerders- of ontwikkelaarsrol nodig) > API
Selecteer/rest/v2/docs is this example (user needs either Admin or Developer role)
Ga naarSelect "auth" > /rest/latestauth/login (gebruiker authenticerenauthenticate user)
Geef de gebruikersnaam + het wachtwoord op dat wordt gebruikt om toegang te krijgen tot live gegevens
Wijzig de aanmeldingsparameters Specify username + password that will be used to access live data
Change the login parameter "rememberme": true, "setCookie": true
De respons bevat accessToken
Toegangstoken is klaar voor gebruik
URL voor webkiosk voorbereiden
The rest field can be removed. Example (try not to leave a comma in the end of the password line):
Response body will provide accessToken
Access token is ready to be used
Prepare Web kiosk URL
Go to http://go.cobundu.com (gebruiker heeft de rol van beheerder of ontwikkelaar nodig) > KioskmodusSelecteer de relevante verdieping > open webkioskuser needs either Admin or Developer role) > Kiosk Mode
Select the relevant floor > open web kiosk
Web Kiosk URL heeft het volgende formaat will have format https://go.cobundu.com/kiosk/MEETING%7C1d18e8b0-48a7-464c-8813-66608b474d6d Vervang het hoofddomein van de URL om het juiste cloud-eindpunt (EU of VS) aan te geven, dan krijg je bijv.
In a browser navigate to https://go.cobundu.com/rest/serverinfo or in Postman make a request to https://go.cobundu.com/rest/serverinfo?jwt= and copy/paste accessToken at the end of the URL
The apiUrl contains a correct cloud end-point for you account (EU or US). Replace go.cobundu.com in your Web Kiosk URL with this region apiUrl, you'll obtain eg https://go.eu1.cloud.cobundu.com/kiosk/MEETING| ...
Voeg achtervoegsel Add suffix "?jwt=" toe en kopieer/plak accessToken aan het einde van de and copy/paste accessToken at the end of the URL
Toegang tot deze Access this URL (bijvoorbeeld for example in incognitomodus) en de webkiosk zal openen op de gekozen verdieping zonder om identificatie te vragen. Elke 10 minuten wordt een sessie vernieuwd binnen de toepassing.
Nadat de token is verkregen, heb je 10 minuten om deze door te geven in de URL om de plattegrond te openen.
Nadat de plattegrond is geladen, wordt het vernieuwen van de token automatisch uitgevoerd zonder sessieverlies of handmatige tussenkomst.
Beperkingen
Webkiosk toont reserveringsweergave (= gecombineerde bezettingsgraad- en reserveringsgegevens (indien beschikbaar))
Als browser crasht/computer is losgekoppeld: herstart het proces om een nieuw toegangstoken te krijgen
incognito mode), and the web kiosk will open on the chosen floor without asking for identification. A session refresh will run inside the application every 10 minutes.
After the token is obtained, there are 10 minutes to pass it in the URL to open the floor plan.
After the floor plan is loaded, further token renewal will run automatically without session loss or any manual intervention.
Limitations
Web kiosk shows Reservation view (= combined Occupancy and Reservations data (if available))
If browser crashes/computer is unplugged: restart the process to get a new access token
Search
Live Search |
---|