Listing Space IDs

Introduction

There are rare situations like when using shell commands that require the ID of a space as parameter. This page shows how to get it. As an example of a use case, see the Manage Trash-Bin Items command set.

Space IDs can currently not be listed by the administrator via the WebUI. They can only be listed via the shell using an authenticated curl GET command accessing the Infinite Scale API.

The following prerequisites apply:

  • The administrator must have shell access where Infinite Scale runs.

  • The administrator needs to use their active bearer token in the request described below.

  • For ease of reading the result, the jq library should be installed on the OS where the shell command is executed. It is used in the examples.

Note that the life span of the bearer token is short, in particular less than a minute. If the token expires, the curl command will fail with an unauthorized message. So it is important to be prepared.

Preparation

  • Open a terminal window for shell access

    • The generated curl command described will be executed here.

  • Prepare an editor

    • Open an editor of choice where you can easily copy and paste to and add the following on top. The example lists personal users space ID’s. Replace it with project for listing manually created spaces. Replace <your host:9200> with the URL:port of the Infinite Scale instance. Note to add a trailing blank line in the example as content is copied afterwards.

      curl -XGET -vk 'https://<your host:9200>/graph/v1.0/drives?$filter=driveType+eq+personal' \
        -H 'Authorization: Bearer ...
      | jq '.'
  • Open a browser

    • Login as administrator at https://<your host:9200>, replace <your host:9200> with the URL:port of the Infinite Scale instance.

    • Open the browsers Developer Console.

    • Open the Network tab.

    • Select XHR, browser dependent, it is maybe called Fetch XHR.

    • Reload the page to get updated content for XHR

    • In the column where you see Name Status Type …​ check that Method is present.
      If not, right click on one column item and select Method.

    • Click on Method to sort, a PROPFIND line should be the first entry.

Get Space IDs

Command Preparation

  • Reload the screen in the browser to get an updated bearer token.

  • Right click on the line containing PROPFIND and select Copy  Copy as cURL (bash).

  • Paste the copied result into the editor under the blank line, this may now look like this, the bearer is shortened in the example for ease of readbility:

    curl -XGET -vk 'https://<your host:9200>/graph/v1.0/drives?$filter=driveType+eq+personal' \
      -H 'Authorization: Bearer ...
    | jq '.'
    
    curl 'https://<your host:9200>/remote.php/dav/spaces/59ee3b90-3231-4621-81aa-4531d33e7671%24fb9e2625-cdb0-4f21-8a34-db775a976707' \
      -X 'PROPFIND' \
      -H 'Accept: */*' \
      -H 'Accept-Language: en' \
      -H 'Authorization: Bearer eyJhb ... C1wUs' \
      -H 'Connection: keep-alive' \
      ...
  • After -H 'Accept-Language: en' \:
    Copy the complete line -H 'Authorization: Bearer eyJhb ... C1wUs' \

  • Replace the Authorisation line on top containing the prepared command with the copied content.
    You now have a full curl command including an active bearer token for authentication that can be used in the next step.

Command Execution

  • Copy the full curl command from the top and paste it into the prepared shell.
    You should get prettyfied json strings printed.

Output

Personal Space
{
  "value": [
    {
      "driveAlias": "personal/admin",
      "driveType": "personal",
      "id": "59ee3b90-3231-4621-81aa-4531d33e7671$fb9e2625-cdb0-4f21-8a34-db775a976707",
      "lastModifiedDateTime": "2024-03-14T12:55:21.538631978+01:00",
      "name": "Admin",
      "owner": {
        "user": {
          "displayName": "",
          "id": "fb9e2625-cdb0-4f21-8a34-db775a976707"
        }
      },
  ...
}


Project Space
{
  "value": [
    {
      "driveAlias": "project/my-project-space",
      "driveType": "project",
      "id": "59ee3b90-3231-4621-81aa-4531d33e7671$ee008d1d-b17d-4c61-a7f5-4e5435d2b4e8",
      "lastModifiedDateTime": "2024-03-14T15:55:41.418616154+01:00",
      "name": "My Project Space",
      "owner": {
        "user": {
          "displayName": "",
          "id": "ee008d1d-b17d-4c61-a7f5-4e5435d2b4e8"
        }
      },
 ...
}

Output Interpretation and Usage

Depending on if you are looking for a personal or project space, find the name of the space in the name or the driveAlias field. The ID identifying the space is under driveType named id like:

"id": "59ee3b90-3231-4621-81aa-4531d33e7671$ee008d1d-b17d-4c61-a7f5-4e5435d2b4e8",

Copy the ID excluding the surrounding double quotes and embed it in single quotes for any tasks that require a space ID as parameter. Example:

"59ee3b90-3231-4621-81aa-4531d33e7671$ee008d1d-b17d-4c61-a7f5-4e5435d2b4e8"
'59ee3b90-3231-4621-81aa-4531d33e7671$ee008d1d-b17d-4c61-a7f5-4e5435d2b4e8'

The single quotes are necessary as the ID contains a $ sign and $ is a special shell character.