Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DifficultyMoeilijkheidsgraad: expert

Go to
Content

Inhoud

Table of Contents
minLevel1
maxLevel1

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

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?

The option appears only for users who have a developer or admin role assigned to them. See Roles & Profiles for more information.

Image RemovedTo use the APIs in your own projects (eg postman), you might be interested to use the
  • Inloggen met je gegevens

De optie verschijnt alleen voor gebruikers met een ontwikkelaars- of beheerdersrol. Zie Roles & Profiles voor meer informatie.

Image Added

Om de API's in je eigen projecten te gebruiken (bijvoorbeeld postman), is het misschien interessant om de swagger.json-link . As you can see in the screenshot, "latest" page opens per default, but this is of course subject to change.

NoteUse numbered versions (eg

te gebruiken. Zoals je in de schermafbeelding kunt zien, wordt de "nieuwste" pagina standaard geopend, maar dit kan natuurlijk veranderen.

Note

Gebruik genummerde versies (bijv. https://go.cobundu.com/rest/v3/docs) to avoid conflicts.

Using a specific version has the advantage of being able to compare API versions in future

om conflicten te vermijden.

Het gebruik van een specifieke versie heeft het voordeel dat je in de toekomst API-versies kunt vergelijken.

Testing the

De API testen:

examples

It's possible to try out/test the Workplace API. Depending on the request, you might need to fill in some information first.

Example 1. Get the list of sensor devices

  1. Select "Try it out",

  2. then "Execute",

  3. to get a list of all sensor devices currently linked to this tenant.

As you can see in the example, each sensor channel (eg humidity, temperature and CO2 in a comfort sensor) is delivered separately.

Image Removed

Example 2. Get the current sensor data for a location

  1. Select "Try it out",

  2. Add the mandatory location ID

  3. then "Execute",

  4. to get the current sensor data of all sensors that are linked to that location.

As you can see in the example, 1 comfort sensor is linked to the requested location. Therefore all channel values available for this sensor (temperature and humidity in this case) are delivered, as well as the timestamp for which these values were received.

Image Removed
Below examples mention “location ID”. Selecting a location on

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.

Voorbeeld 1. De lijst met sensorapparaten ophalen

  1. Selecteer "Uitproberen",

  2. en vervolgens "Uitvoeren",

  3. om een lijst te krijgen van alle sensorapparaten die momenteel aan deze huurder zijn gekoppeld.

Zoals je in het voorbeeld kunt zien, wordt elk sensorkanaal (bv. vochtigheid, temperatuur en CO2 in een comfortsensor) afzonderlijk geleverd.

Image Added

Voorbeeld 2. De huidige sensorgegevens voor een locatie ophalen

  1. Selecteer "Uitproberen",

  2. Voeg de verplichte locatie-ID toe

  3. en vervolgens "Uitvoeren",

  4. om de huidige sensorgegevens op te halen van alle sensoren die gekoppeld zijn aan die locatie.

Zoals je in het voorbeeld kunt zien, is er 1 comfortsensor gekoppeld aan de opgevraagde locatie. Daarom worden alle beschikbare kanaalwaarden voor deze sensor (temperatuur en vochtigheid in dit geval) geleverd, evenals de tijdstempel waarvoor deze waarden werden ontvangen.

Image Added

In de onderstaande voorbeelden wordt "locatie-ID" genoemd. Een locatie selecteren op https://go.cobundu.com/ will show the Reference, e.g. "Meeting Room wordt de referentie weergegeven, bijvoorbeeld "Vergaderzaal 1". But Maar in the Workplace de back-end , each location has a unique location van Workplace heeft elke locatie een unieke locatie-ID.

Info

Location Locatie-ID is available beschikbaar in the Workplace de back-end van Workplace https://studio.cobundu.com URL for each selected location.

For example the Location ID for floor “2nd floor” in Spacewell Antwerp offices is “910000000004545”

Image Removed

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.

Example 4. Get location information

Selecting a location on

voor elke geselecteerde locatie.

Bijvoorbeeld de Locatie ID voor verdieping "2e verdieping" in Spacewell Antwerpen is "910000000004545".

Image Added

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 op https://go.cobundu.com/ will show the Reference, e.g. "Meeting Room wordt de referentie weergegeven, bijvoorbeeld "Vergaderzaal 1". But Maar in the Workplace de back-end , each location has a unique location van Workplace heeft elke locatie een unieke locatie-ID.


Locations API can help you get that information.
Depending on what is needed:

  • get a list of locations for this client

  • request specific location information (for example information on a set of workplaces

    kan je helpen die informatie te krijgen.
    Afhankelijk van wat er nodig is:

    • een lijst met locaties krijgen voor deze klant

    • specifieke locatie-informatie opvragen (bijvoorbeeld informatie over een reeks "workplace"): "get location tree" (filter top-level results resultaten = workplace)

    Example Voorbeeld 5. Floor planTo get a Workplace floor plan, select Plattegrond

    Om een plattegrond van de workplace te krijgen, selecteer je API Locations > "get a location's drawing as SVG"
    The requested location ID in this case is the floor .
    De gevraagde locatie-ID is in dit geval de verdiepings-ID.
    "TestingTesten" in swagger will provide a response, but it cannot show the SVG. Enter the floor location ID in following URL to see the SVGgeeft een antwoord, maar kan de SVG niet weergeven.

    Voer de vloerlocatie-ID in de volgende URL in om de SVG te zien: https://go.eu1.cloud.cobundu.com/rest/latest/locations/floor location vloer locatie ID/drawingtekeningen/svg

    Concrete use case: URL

    to 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 acces 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

    om live plattegrond te tonen

    Stel 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 hier: Workplace live floorplan data visualization

    The below suggested dedicated method includes web authentication De hieronder voorgestelde speciale methode omvat webauthenticatie via Rest API. This 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.

    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

    Using API to get session token

    Go to

    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

    Search
    1. API gebruiken om sessietoken te krijgen

      1. Ga naar http://go.cobundu.com (user needs either Admin or Developer role) >  API

        Select

        gebruiker heeft een beheerders- of ontwikkelaarsrol nodig) > API

        1. Selecteer "auth" > /rest/latest/auth/ssosettings/{loginId} (return sso settings for the user)

        2. Provide user name

        3.  Response body will provide the host name of cobundu SSO instance that needs to be used retourneer sso-instellingen voor de gebruiker)

        4. Geef gebruikersnaam

        5. De respons geeft de hostnaam van de cobundu SSO-instantie die moet worden gebruikt (Workplace IoT Platform is available for EU and US) (could be eg  beschikbaar voor de EU en de VS) (kan bijvoorbeeld "apiUrl" zijn: https://go.eu1.cloud.cobundu.com )

      2. Still on Nog steeds op http://go.cobundu.com (user needs either Admin or Developer role) >  API

        Select

        gebruiker heeft een beheerders- of ontwikkelaarsrol nodig) > API

        Go to
        1. Selecteer "auth" > /rest/latest/login (authenticate usergebruiker authenticeren)

        2. Specify username + password that will be used to access live data

        3. Change the login parameters Geef de gebruikersnaam + het wachtwoord op dat wordt gebruikt om toegang te krijgen tot live gegevens

        4. Wijzig de aanmeldingsparameters "rememberme": true, "setCookie": true

        5.  Response body will provide De respons bevat accessToken

        6. Access token is ready to be used

      Prepare Web kiosk URL

        1. Toegangstoken is klaar voor gebruik

    2. URL voor webkiosk voorbereiden

      1. Ga naar http://go.cobundu.com (user needs either Admin or Developer role) > Kiosk ModeSelect the relevant floor > open web kioskgebruiker heeft de rol van beheerder of ontwikkelaar nodig) > Kioskmodus

      2. Selecteer de relevante verdieping > open webkiosk

      3. Web Kiosk URL will have format heeft het volgende formaat https://go.cobundu.com/kiosk/MEETING%7C1d18e8b0-48a7-464c-8813-66608b474d6d

      4. Replace root domain of the URL to indicate to the correct cloud end-point (EU or US), you'll obtain eg Vervang het hoofddomein van de URL om het juiste cloud-eindpunt (EU of VS) aan te geven, dan krijg je bijv. https://go.eu1.cloud.cobundu.com/kiosk/MEETING| ...

      5. Add suffix Voeg achtervoegsel "?jwt=" and copy/paste accessToken at the end of the toe en kopieer/plak accessToken aan het einde van de URL

    3. Access this Toegang tot deze URL (for example bijvoorbeeld in 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.

    4. After the token is obtained, there are 10 minutes to pass it in the URL to open the floor plan.

    5. 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

    1. 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.

      1. Nadat de token is verkregen, heb je 10 minuten om deze door te geven in de URL om de plattegrond te openen.

      2. 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


    Zoek op

    Live Search