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 static | GET of one entity or value, read as T. |
List static | GET of a collection, read item by item as T. |
Bytes static | GET of raw bytes, such as a document's Content. |
Put static | PUT of raw bytes, such as a document's Content. |
Text static | GET of plain text, such as Configuration/ProductVersion/$value. |
PostList static | POST whose response is a collection, read item by item as T. |
Post static | Create an entity, or invoke an action. |
Post static | POST reading no answer. |
Patch static | Change the properties in body, leaving the rest as they are. |
Delete static | DELETE. |
Method property | The HTTP method. |
Path property | The resource path, relative to the service root. |
Query property | The query options, possibly ODataQuery.None. |
Headers property | The headers this request adds. |
Body property | The body, serialized as JSON when sent (bytes are sent as they are), or null for none. |
Response property | How the response body is read. |
Timeout property | This request's own timeout, or null for the session's. |
Requirement property | What this request needs the server to define, or null. |
WithQuery | A copy with these query options instead. |
WithHeader | A copy with a header added or replaced, such as If-Match. |
WithTimeout | A copy that may go timeout 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. |
IfMatch | A copy sent with If-Match. |
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 | The path and query, relative to the service root. |
ToString | METHOD relative-uri, for logs. |
Get
staticTm1Request<T> Get<T>(ODataPath path, ODataQuery? query = null)GET of one entity or value, read as T.
List
staticTm1Request<T> List<T>(ODataPath path, ODataQuery? query = null)GET of a collection, read item by item as
T.
Bytes
staticTm1Request<byte[]> Bytes(ODataPath path)GET of raw bytes, such as a document's Content.
Put
staticTm1Request<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
staticTm1Request<string> Text(ODataPath path)GET of plain text, such as
Configuration/ProductVersion/$value.
PostList
staticTm1Request<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
staticTm1Request<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
staticTm1Request<NoContent> Post(ODataPath path, object? body)POST reading no answer.
Patch
staticTm1Request<NoContent> Patch(ODataPath path, object body)PATCH: change the properties in body, leaving the rest as
they are.
Delete
staticTm1Request<NoContent> Delete(ODataPath path)DELETE.
Method
propertystring MethodThe HTTP method.
Path
propertyODataPath PathThe resource path, relative to the service root.
Query
propertyODataQuery QueryThe query options, possibly ODataQuery.None.
Headers
propertyIReadOnlyDictionary<string, string> HeadersThe headers this request adds.
Body
propertyobject? BodyThe body, serialized as JSON when sent (bytes are sent as they are), or null for none.
Response
propertyTm1Response ResponseHow the response body is read.
Timeout
propertyTimeSpan? TimeoutThis request's own timeout, or null for the session's.
Requirement
propertyTm1Capability? RequirementWhat 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
ArgumentExceptiontimeoutisn'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.