Skip to content

ApplicationService fails to access applications inside private folders #1317

@nicolasbisurgi

Description

@nicolasbisurgi

Describe the bug
When accessing applications located inside private folders, the ApplicationService methods (get_names, get, exists, delete, rename, etc.) fail with a 404 error. This is because the TM1 REST API requires using PrivateContents('FolderName') instead of Contents('FolderName') when navigating through private folders in the path.

For example, if Subfolder2 is a private folder, the current implementation generates:

/api/v1/Contents('Applications')/Contents('Subfolder2')/PrivateContents

But the API requires:

/api/v1/Contents('Applications')/PrivateContents('Subfolder2')/PrivateContents

The private parameter only controls whether to use Contents or PrivateContents for the leaf (final) request, not for the intermediate path segments.

To Reproduce

  1. Create PublicFolder under root
  2. Create PrivateSubFodler under PublicFolder
  3. Publish an application under PrivateSubFodler

Then run:

with TM1Service(**tm1_params) as tm1:

    # This fails with 404 because the path uses Contents('PrivateSubFodler')
    # instead of PrivateContents('PrivateSubFodler')
    names = tm1.applications.get_names(path="PublicFolder/PrivateSubFodler", private=True)

Expected behavior
The ApplicationService should automatically detect when folders in the path are private and use PrivateContents for those segments. Once a folder is private, all subfolders are also private (you cannot have public assets inside a private folder).

Version

  • TM1py: All versions
  • TM1 Server Version: All versions (including Planning Analytics Cloud)

Additional context
The fix involves:

  1. Adding path resolution logic that probes the API to discover which folders are private
  2. Trying optimistic approaches first (all-public, then all-private) for performance
  3. Falling back to iterative discovery to find the exact transition point
  4. Optional caching of discovered private boundaries via use_cache parameter
  5. Emitting warnings when auto-resolution is used so users are aware

This is an API limitation from IBM - ideally the API should accept the path regardless of whether intermediate folders are accessed via Contents or PrivateContents, but since we cannot change the API, TM1py needs to handle this.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions