-
Notifications
You must be signed in to change notification settings - Fork 118
Description
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
- Create
PublicFolderunder root - Create
PrivateSubFodlerunderPublicFolder - 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:
- Adding path resolution logic that probes the API to discover which folders are private
- Trying optimistic approaches first (all-public, then all-private) for performance
- Falling back to iterative discovery to find the exact transition point
- Optional caching of discovered private boundaries via
use_cacheparameter - 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.