Tm1Request
from skipcheck_tm1 import Tm1RequestOne TM1 REST call, described but not sent: the method, path, query, headers and body, and how to read the response.
Every service method is built on one of these. The same request can be sent on its own
(the service's ordinary methods do that) or added to a $batch, so anything the
client can do one request at a time, it can also batch. Requests are immutable.
# A cube's name, read as plain JSON
cube = Tm1Request.get(ODataPath.of("Cubes").key("Sales"), ODataQuery.none().select("Name"), dict)
# An action with no answer
reserve = Tm1Request.post(ODataPath.of("Cubes").key("Sales").action("tm1.Reserve"), {})
Members
method | The HTTP method. |
path | The resource path, relative to the service root. |
query | The query options. |
headers | The headers this request adds, in the order they were added. |
body | The body, serialized as JSON when sent, or None for none. |
response | How the response body is read. |
type | The class the response, or each item of a collection, is read as. |
timeout | This request's own timeout, if it has one; otherwise the session's applies. |
capability | |
content_type | |
get static | GET of one entity or value, read as type. |
list static | GET of a collection, read item by item as item_type. |
bytes static | GET of raw bytes, such as a document's Content. |
put static | PUT of raw bytes, as application/octet-stream unless said otherwise, such as a document's Content. |
text static | GET of plain text, such as Configuration/ProductVersion/$value. |
post_list static | POST whose response is a collection, read item by item as item_type. |
post static | POST; type None means no answer is read (Java's Void). |
patch static | Change the properties in body, leaving the rest as they are. |
delete static | DELETE of the entity at path. |
with_query | A copy with these query options instead. |
with_header | A copy with a header added or replaced, such as If-Match. |
with_timeout | A copy that may go seconds without receiving any data before it fails, instead of the session's request timeout. |
requires | The request, checked against the server's $metadata before it's sent. |
requirement | What this request needs the server to define, or None. |
if_match | A copy sent with If-Match. |
is_idempotent | Whether sending it twice has the effect of sending it once. |
relative_uri | The encoded path and query relative to the service root, such as Cubes('Sales')?$select=Name. |
read | Reads the answer as the request says to. |
to_call | The request as the sessions send it. |
method
method: strThe HTTP method.
path
path: ODataPathThe resource path, relative to the service root.
query
query: ODataQueryThe query options.
headers
headers: Mapping[str, str]The headers this request adds, in the order they were added.
body
body: Any The body, serialized as JSON when sent, or None for none.
response
response: Tm1Request.ResponseHow the response body is read.
type
type: AnyThe class the response, or each item of a collection, is read as.
timeout
timeout: float | NoneThis request's own timeout, if it has one; otherwise the session's applies.
capability
capability: Tm1Capability | Nonecontent_type
content_type: str | Noneget
staticget(path: ODataPath, query: ODataQuery | None, type: Any) -> Tm1Request[Any]GET of one entity or value, read as type.
list
staticlist(path: ODataPath, query: ODataQuery | None, item_type: Any) -> Tm1Request[Any]GET of a collection, read item by item as item_type.
bytes
staticbytes(path: ODataPath) -> Tm1Request[bytes]GET of raw bytes, such as a document's Content.
put
staticput(path: ODataPath, content: bytes, content_type: str = 'application/octet-stream') -> Tm1Request[None]PUT of raw bytes, as application/octet-stream unless said otherwise, such as a document's Content. TM1 (11.8) refuses a chunked body (400, with no message), so the bytes are sent with their Content-Length: the whole content is held in memory while it's sent.
text
statictext(path: ODataPath) -> Tm1Request[str]GET of plain text, such as Configuration/ProductVersion/$value.
post_list
staticpost_list(path: ODataPath, body: Any, item_type: Any) -> Tm1Request[Any]POST whose response is a collection, read item by item as item_type: an action returning Collection(...), such as tm1.CheckRules. body is the parameters, written as JSON.
post
staticpost(path: ODataPath, body: Any, type: Any = None) -> Tm1Request[Any]POST; type None means no answer is read (Java's Void).
patch
staticpatch(path: ODataPath, body: Any) -> Tm1Request[None]PATCH: change the properties in body, leaving the rest as they are.
delete
staticdelete(path: ODataPath) -> Tm1Request[None]DELETE of the entity at path.
with_query
with_query(query: ODataQuery | None) -> Tm1Request[T]A copy with these query options instead.
with_header
with_header(name: str, value: str) -> Tm1Request[T]A copy with a header added or replaced, such as If-Match.
with_timeout
with_timeout(seconds: float) -> Tm1Request[T]A copy that may go seconds without receiving any data before it fails, instead of the session's request timeout. For calls TM1 only answers when the work is done, such as a long process run. Must be positive.
requires
requires(capability: Tm1Capability) -> Tm1Request[T]The request, checked against the server's $metadata before it's sent: an skipcheck_tm1.errors.Tm1UnsupportedOperationError instead if it lacks it.
requirement
requirement() -> Tm1Capability | NoneWhat this request needs the server to define, or None.
if_match
if_match(etag: str) -> Tm1Request[T]A copy sent with If-Match: etag, failing with 412 if the entity has changed since.
is_idempotent
is_idempotent() -> boolWhether sending it twice has the effect of sending it once: GET, PUT, DELETE, HEAD.
relative_uri
relative_uri() -> strThe encoded path and query relative to the service root, such as Cubes('Sales')?$select=Name.
read
read(reply: Reply) -> AnyReads the answer as the request says to: nothing, bytes, text (without a byte order mark), one value, or a page of a collection.
to_call
to_call() -> CallThe request as the sessions send it.