skipcheck

TM1 client · Docs · The client

Tm1Request

using Skipcheck.Tm1.Client;

One 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
var cube = Tm1Request.Get<JsonElement>(ODataPath.Of("Cubes").Key("Sales"), ODataQuery.None().Select("Name"));
// An action with no answer
var reserve = Tm1Request.Post(ODataPath.Of("Cubes").Key("Sales").Action("tm1.Reserve"), new { });

Members

Get staticGET of one entity or value, read as T.
List staticGET of a collection, read item by item as T.
Bytes staticGET of raw bytes, such as a document's Content.
Put staticPUT of raw bytes, such as a document's Content.
Text staticGET of plain text, such as Configuration/ProductVersion/$value.
PostList staticPOST whose response is a collection, read item by item as T.
Post staticCreate an entity, or invoke an action.
Post staticPOST reading no answer.
Patch staticChange the properties in body, leaving the rest as they are.
Delete staticDELETE.
Method propertyThe HTTP method.
Path propertyThe resource path, relative to the service root.
Query propertyThe query options, possibly ODataQuery.None.
Headers propertyThe headers this request adds.
Body propertyThe body, serialized as JSON when sent (bytes are sent as they are), or null for none.
Response propertyHow the response body is read.
Timeout propertyThis request's own timeout, or null for the session's.
Requirement propertyWhat this request needs the server to define, or null.
WithQueryA copy with these query options instead.
WithHeaderA copy with a header added or replaced, such as If-Match.
WithTimeoutA copy that may go timeout without receiving any data before it fails, instead of the session's request timeout.
RequiresThe request, checked against the server's $metadata before it's sent.
IfMatchA copy sent with If-Match.
IsIdempotentWhether sending the request again does what sending it once did (GET, PUT, DELETE, HEAD), so it may be retried after a response was lost.
RelativeUriThe path and query, relative to the service root.
ToStringMETHOD relative-uri, for logs.

Get

static
Tm1Request<T> Get<T>(ODataPath path, ODataQuery? query = null)

GET of one entity or value, read as T.

List

static
Tm1Request<T> List<T>(ODataPath path, ODataQuery? query = null)

GET of a collection, read item by item as T.

Bytes

static
Tm1Request<byte[]> Bytes(ODataPath path)

GET of raw bytes, such as a document's Content.

Put

static
Tm1Request<NoContent> Put(ODataPath path, byte[] content, string contentType = "application/octet-stream")

PUT of raw bytes, 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.

Text

static
Tm1Request<string> Text(ODataPath path)

GET of plain text, such as Configuration/ProductVersion/$value.

PostList

static
Tm1Request<T> PostList<T>(ODataPath path, object body)

POST whose response is a collection, read item by item as T: an action returning Collection(...), such as tm1.CheckRules.

Post

static
Tm1Request<T> Post<T>(ODataPath path, object? body)

POST: create an entity, or invoke an action. Actions always get a JSON body (an empty object for a null body), since TM1 refuses an action without a JSON content type.

Post

static
Tm1Request<NoContent> Post(ODataPath path, object? body)

POST reading no answer.

Patch

static
Tm1Request<NoContent> Patch(ODataPath path, object body)

PATCH: change the properties in body, leaving the rest as they are.

Delete

static
Tm1Request<NoContent> Delete(ODataPath path)

DELETE.

Method

property
string Method

The HTTP method.

Path

property
ODataPath Path

The resource path, relative to the service root.

Query

property
ODataQuery Query

The query options, possibly ODataQuery.None.

Headers

property
IReadOnlyDictionary<string, string> Headers

The headers this request adds.

Body

property
object? Body

The body, serialized as JSON when sent (bytes are sent as they are), or null for none.

Response

property
Tm1Response Response

How the response body is read.

Timeout

property
TimeSpan? Timeout

This request's own timeout, or null for the session's.

Requirement

property
Tm1Capability? Requirement

What this request needs the server to define, or null.

WithQuery

Tm1Request<T> WithQuery(ODataQuery? query)

A copy with these query options instead.

WithHeader

Tm1Request<T> WithHeader(string name, string value)

A copy with a header added or replaced, such as If-Match.

WithTimeout

Tm1Request<T> WithTimeout(TimeSpan timeout)

A copy that may go timeout 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.

Throws

ArgumentException
timeout isn't positive.

Requires

Tm1Request<T> Requires(Tm1Capability capability)

The request, checked against the server's $metadata before it's sent.

IfMatch

Tm1Request<T> IfMatch(string etag)

A copy sent with If-Match: etag, failing with 412 if the entity has changed since.

IsIdempotent

bool IsIdempotent()

Whether sending the request again does what sending it once did (GET, PUT, DELETE, HEAD), so it may be retried after a response was lost.

RelativeUri

string RelativeUri()

The path and query, relative to the service root.

ToString

string ToString()

METHOD relative-uri, for logs.