content
content(document: ContentPath) -> bytesA document's Content, as bytes. The path is a document reference, or a document in Blobs.
TM1 REST Navigation DocumentReference/Document
from skipcheck_tm1.services import ContentService The contents tree, where Planning Analytics keeps applications: folders, documents,
links, and references to cubes, dimensions, subsets, views, processes and chores.
Entries are addressed by ContentPath.
What TM1 (11.8) does here that you might not expect:
ID, not Name (see ContentPath).DocumentReference there, to a
Document TM1 makes in Blobs with a timestamp in its name, such as
notes_20261122125939.txt. Its content goes through the reference
(content, upload). A copy of the reference refers to the same
document; deleting a reference leaves the document while another refers to it.Build an application: a folder, a link and a cube reference:
# An application: a folder with a link and a reference to a cube
planning = ContentPath.applications().child("Planning")
tm1.contents.create(ContentPath.applications(), ContentScope.PUBLIC, FolderPatch.builder().name("Planning").build())
tm1.contents.create(planning, ContentScope.PUBLIC, LinkPatch.builder().name("Guide").url("https://example.com/planning-guide").build())
sales = CubeReferencePatch.builder().name("Sales").bind_cube(ODataPath.of("Cubes").key("Sales")).build()
return tm1.contents.create(planning, ContentScope.PUBLIC, sales)
Upload a document from a file:
# A document made in an application is a reference to one TM1 keeps in Blobs; the
# reference, as create returns it, is where its content goes
planning = ContentPath.applications().child("Planning")
reference = tm1.contents.create(planning, ContentScope.PUBLIC, DocumentPatch.builder().name("notes.txt").build())
tm1.contents.upload(planning.child(reference), file.read_bytes())
Download a document's content to a file:
# The document's content comes back whole, as bytes
notes = ContentPath.applications().child("Planning").child("notes.txt.blob")
file.write_bytes(tm1.contents.content(notes))
List the cubes an application refers to:
# The cubes an application refers to, by a cast expand
entries = tm1.contents.contents(ContentPath.applications().child("Planning"), ContentScope.PUBLIC, expand="tm1.CubeReference/Cube($select=Name)")
return [entry.cube.name for entry in entries if isinstance(entry, CubeReference) and isinstance(entry.cube, Cube)]
The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncContentService.
roots | The root folders, Applications and Blobs. |
get | GET of one entry. |
contents | A folder's public or private entries, each of its own kind. |
create | Makes an entry in a folder. |
delete | DELETE of an entry, and everything in it if it's a folder. |
contained_by | The folder an entry is in. |
localized_attributes | An entry's attributes in each locale. |
copy | Copies an entry into the folder target, public or private, named name or as the entry is. |
move | Moves an entry into the folder target, public or private there, renamed name if given; returns the entry where it is now. |
document | The document a reference refers to, in Blobs, with its Size and LastUpdated. |
content | A document's Content, as bytes. |
upload | Replaces a document's Content. |
roots(query: ODataQuery | None = None, **options: Any) -> list[Entry]GET Contents: the root folders, Applications and Blobs.
TM1 REST EntitySet Contents
get(entry: ContentPath, query: ODataQuery | None = None, **options: Any) -> EntryGET of one entry: of its own kind (Folder, Link, CubeReference …), or a Tm1NotFoundError if there's none. A reference's object comes by a cast expand, such as expand="tm1.CubeReference/Cube".
TM1 REST EntitySet Contents
contents(folder: ContentPath, scope: ContentScope = ContentScope.PUBLIC, query: ODataQuery | None = None, **options: Any) -> list[Entry]A folder's public or private entries, each of its own kind. References' objects come by a cast expand, such as expand="tm1.CubeReference/Cube($select=Name)".
TM1 REST Navigation Folder/Contents Navigation Folder/PrivateContents Navigation ChoreReference/Chore Navigation CubeReference/Cube Navigation DimensionReference/Dimension Navigation ProcessReference/Process Navigation SubsetReference/Subset Navigation ViewReference/View
create(folder: ContentPath, scope: ContentScope, entry: Any) -> EntryMakes an entry in a folder: a FolderPatch, DocumentPatch, LinkPatch or a reference, such as a CubeReferencePatch with bind_cube(ODataPath.of("Cubes").key("Sales")). A document made outside Blobs comes back as a DocumentReference, with an empty document behind it; upload gives it content. Returns the entry as made, with the ID to find it by.
TM1 REST Navigation Folder/Contents Navigation Folder/PrivateContents
delete(entry: ContentPath) -> NoneDELETE of an entry, and everything in it if it's a folder.
TM1 REST EntitySet Contents
contained_by(entry: ContentPath, query: ODataQuery | None = None, **options: Any) -> FolderContainedBy: the folder an entry is in.
TM1 REST Navigation Entry/ContainedBy
localized_attributes(entry: ContentPath, query: ODataQuery | None = None, **options: Any) -> list[LocalizedAttributes]LocalizedAttributes: an entry's attributes in each locale.
TM1 REST Navigation Entry/LocalizedAttributes
copy(entry: ContentPath, target: ContentPath, scope: ContentScope, name: str | None = None) -> Entrytm1.Copy: copies an entry into the folder target, public or private, named name or as the entry is. A copied document reference refers to the same document.
TM1 REST Action Entry/Copy
move(entry: ContentPath, target: ContentPath, scope: ContentScope, name: str | None = None) -> Entrytm1.Move: moves an entry into the folder target, public or private there, renamed name if given; returns the entry where it is now.
TM1 REST Action Entry/Move
document(reference: ContentPath, query: ODataQuery | None = None, **options: Any) -> DocumentDocument: the document a reference refers to, in Blobs, with its Size and LastUpdated.
TM1 REST Navigation DocumentReference/Document
content(document: ContentPath) -> bytesA document's Content, as bytes. The path is a document reference, or a document in Blobs.
TM1 REST Navigation DocumentReference/Document
upload(document: ContentPath, content: bytes) -> NoneReplaces a document's Content. The path is a document reference, or a document in Blobs. TM1 (11.8) refuses a chunked upload, so the content is sent whole, with its length.
TM1 REST Navigation DocumentReference/Document