Jetzt verfügbar:  Berichte für DRACOONMehr Infos

Question to "/v4/nodes/rooms/{room_id}/groups" API Call

Kommentare

3 Kommentare

  • Offizieller Kommentar
    Avatar
    Michael Netter

    Hi Benedikt,

    Here's an example how you can parse the response and loop through the items:

    $Token = ... # Contains your OAuth access token
    # Fetch group information
    $Response = Invoke-WebRequest -URI "https://dracoon.team/api/v4/nodes/rooms/12345/groups" -Method Get -ContentType "application/json" -Headers @{Authorization=("Bearer {0}" -f $Token)}

    $Content = ConvertFrom-Json $Response.content
    for ($i=0; $i -lt $Content.items.length; $i++){
    Write-Output $Content.items[$i]
    }

    Please note that if your response contains more than 500 items, you need to use the offset parameter and the range model.

    Best regards,

    Michael

    Aktionen für Kommentare Permalink
  • Avatar
    DAVISOL - Sebastian Hübner

    Hi Benedikt,

    the response of API calls is usually of type application/json. If you read the response content as System.String, you could use the ConvertFrom-Json cmdlet (link to docs) to parse the string to a custom object or hash table. As stated in the PowerShell docs, you may also want to use the Invoke-RestMethod cmdlet instead:

    You can also use the Invoke-RestMethod cmdlet, which automatically converts JSON content to objects.

    The object schema of your request's response is very well documented in Swagger. To access this documentation, just add "/api/swagger-ui.html#/" to your DRACOON domain name (e.g. https://mydracoon123.dracoon.team/api/swagger-ui.html#/).

    Hope that helps,

    Sebastian

    2
    Aktionen für Kommentare Permalink
  • Avatar
    Benedikt Hild

    Hello,

    thanks for your help!

    With the ConvertFrom-Json cmdlet it worked on the first try. 

     

    Best regards,

    Benedikt 

    0
    Aktionen für Kommentare Permalink

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.