Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Automatically translated by Lango

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 Workplace API's 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.

Toegang krijgen tot Workplace API

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

image-20240524-135305.png

Note

For every API method, make sure to chose the latest version

Status September Zorg ervoor dat u voor elke API-methode de nieuwste versie kiest

Status september 2024

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-20240524-135529.pngImage 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-20240524-135801.pngImage Removed
Below examples mention “location ID”. Selecting a location on

voorbeelden

Het is mogelijk om de Workplace API 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-20240524-135529.pngImage 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-20240524-135801.pngImage 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 werkplekken): "get location tree" (filter top-level results resultaten = workplace)

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

    Selecteer API Locations > "get a location's drawing as SVG"
    The requested location ID in this case is the floor om een plattegrond van Workplace te krijgen.
    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/v3/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 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

    om live plattegrond te tonen

    Stel je voor dat je een URL naar je kioskschermen wilt pushen om Workplace live plattegrondgegevens te visualiseren.

    Hier stellen we voor om een toegangstoken met een URL 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 Dit betekent dat een 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 wachtwoord nodig zijn, en de API zal een JWT token teruggeven dat kan worden gebruikt om toegang te krijgen tot alle andere API-aanroepen. Voor een autorisatie-gerelateerde actie hebben we de COBUNDU Authorization service. Deze heeft een openbare Swagger UI (en swagger.json-link) available at beschikbaar op https://login.cobundu.com/rest/v2/docs. You may use the API Je kunt de API gebruiken via Swagger UI or of Postman, or any other tool of your choice. This example is based on our of een andere tool naar keuze. Dit voorbeeld is gebaseerd op onze Swagger UI.

    Note

    For every Zorg ervoor dat je voor elke auth-based API method, make sure to choose the latest version (status September gebaseerde API-methode de nieuwste versie kiest (status september 2024: v2 is the latest, so refer to de nieuwste, dus raadpleeg https://login.cobundu.com/rest/v2/docs)

    Prerequisites

    Web kiosk needs to be configured

    Vereisten

    • Webkiosk moet worden geconfigureerd 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
    • 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 https://login.cobundu.com/rest/v2/docs (user needs either Admin or Developer role)

        Select

        gebruiker moet de rol Admin of Developer hebben)

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

        2. Provide user name

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

        4. Geef gebruikersnaam

        5. De respons geeft de hostnaam van de COBUNDU Auth-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://login.eu1.cloud.cobundu.com)

          image-20240910-073257.png
      2. Navigate to the Navigeer naar de apiUrl + /rest/v2/docs from previous step that van de vorige stap dat is https://login.eu1.cloud.cobundu.com/rest/v2/docs is this example (user needs either Admin or Developer role)

        Select

        dit voorbeeld (gebruiker moet de rol Admin of Developer hebben)

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

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

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

        4. Wijzig de aanmeldparameter "rememberme": true

        5. The rest field can be removed. Example (try not to leave a comma in the end of the password lineHet restveld kan worden verwijderd. Voorbeeld (probeer geen komma aan het einde van de wachtwoordregel te laten staan):

          image-20240910-073146.png

           Response

        6. body will provide De respons bevat accessToken

          image-20240910-073431.png

        7. 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. In a browser navigate to Navigeer in een browser naar https://go.cobundu.com/rest/serverinfo or in Postman make a request to of in Postbode een verzoek indienen bij https://go.cobundu.com/rest/serverinfo?jwt= and copy en kopieer/paste accessToken at the end of the plak accessToken aan het einde van de URL

        image-20240910-073939.png

      5. The De apiUrl contains a bevat een correct cloud end-point for you -eindpunt voor uw account (EU or USof VS). Replace Vervang go.cobundu.com in your je Web Kiosk URL with this region apiUrl, you'll obtain eg met deze regio apiUrl, krijg je bijv. https://go.eu1.cloud.cobundu.com/kiosk/MEETING| ...

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