Listing Space IDs

Introduction

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

  1. Via the web UI
    Users can enable seeing WebDAV URLs via their personal preferences of the Infinite Scale WebUI. This URL contains the space ID.

  2. Via CLI
    Alternatively, administrators can impersonate the respective user and get the space ID via shell commands using an authenticated curl GET accessing the Infinite Scale API.

    The following prerequisites apply:

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

    • The administrator needs to use the 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.

Via the web UI

When the user has enabled in his personal preferences Show WebDAV information in details view, the space ID can be identified the following:

  • Select a space and toggle the sidbar button on the top right to show the details.

  • The WebDAV URL shows:
    <your host url>/remote.php/dav/spaces/c7763488-…​-20badd5126b4/<optional file name>

  • The space ID is c7763488-…​-20badd5126b4.

  • Copy the ID and embed it in single quotes for any tasks that require a space ID as parameter.

    Example:

    c7763488-…​-20badd5126b4'c7763488-…​-20badd5126b4'

    Single quotes are necessary because the ID can contain a $ sign which is a special character the shell.

Via CLI

Explanation

Infinite Scale, except if not otherwise configured via the auth-basic service, does not accept basic authentication for security reasons. Therefore, if using a curl command, one must login via the browser and get the short living bearer token via the developer view for further processing.

Preparation

  • Open a terminal window for shell access.

    • The assembled curl command from the editor will be used for final execution.

  • Prepare an editor.
    The editor is used to assemble the command that is further copied to the console to get the final result.

    • Open an editor of choice.
      Paste the following on top of the editor:

      • Replace <your host[:port]> with the URL:port of your Infinite Scale instance.
        You can omit the port if default.

      • The example lists personal users space ID’s.
        Replace it with project for listing manually created spaces.

      • The {token} placeholder will later be replaced by the real bearer token you get from the browser.

      • Note to add a trailing blank line in the example as content is copied afterwards.

        curl -vk \
          'https://<your host:9200>/graph/v1.0/drives?%24orderby=name%20asc&%24filter=driveType%20eq%20%27personal%27' \
          -H 'accept: application/json' \
          -H 'authorization: Bearer {token}' \
          | jq '.'

        Omit -v (add verbosity) or -k (skip certificate verification) if not needed.

  • Open a browser

    • Login as administrator at https://<your host:9200>

      • Replace <your host:9200> with the URL:port of the Infinite Scale instance.

      • Use the files view as starting point.

    • Open the browsers Developer Console
      In Firefox: More Tools  Web  Developer Tools

    • 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 to make it visible.

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

    • Note that only the header authorization line in the response is of interrest.

    curl -vk \
      'https://<your host:9200>/graph/v1.0/drives?%24orderby=name%20asc&%24filter=driveType%20eq%20%27personal%27' \
      -H 'accept: application/json' \
      -H 'authorization: Bearer {token} \
      | 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' \
      ...
  • 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 is 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.

  • If you get no output or, when using verbosity an output on top contaning: Closing connection, the bearer token has expired and needs to be refreshed for authentication. To do so, start again with Command Preparation.

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

  • For any 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-…​-a7f5-4e5435d2b4e8"'59ee3b90-…​-a7f5-4e5435d2b4e8'

    Single quotes are necessary because the ID can contain a $ sign which is a special character the shell.