TTMSMCPResources.RegisterTemplateResource Method
Publishes a resource covering a family of addresses in a single call.
API unit family: TMS.MCP.Resources
Declaring type: TTMSMCPResources
Syntax
procedure RegisterTemplateResource(const AName, AURITemplate, ADescription, AMimeType: string; AResourceReader: TTMSMCPResourceMethod);
Remarks
The entry is built and copied into the collection, and the temporary instance is released before returning, so nothing is left for the caller to free.
Parameters
| Name | Description |
|---|---|
AName |
Identifier the entry is listed under. Must not be empty. |
AURITemplate |
Address pattern with each variable part written between braces, for example db://tables/{table}. Must not be empty. |
ADescription |
Text telling a model what the entries behind the pattern hold. May be empty. |
AMimeType |
Media type published as a hint for the content. May be empty. |
AResourceReader |
Code that produces the content. It receives the expanded address and has to read the variable parts out of it. Must be assigned. |
Exceptions
| Exception | Description |
|---|---|
EJsonRpcException |
Raised with invalid-parameters, error code -32602, when the name or the pattern is empty or no handler is supplied. |