Template definition with SDK

Hi!
Up to now, I’ve been using this method to create java classes from the template opt

I’ve been using DefinitionAPI through PostMan to define the template, because if not I got an error that the ID template does not exist. Is there any way to define a template, with its template ID through OpenEhr_SDK?

Using the Definition API is a perfectly correct way (IMO) to upload a template to the CDR. What is the problem with that approach?

Hi @Alex_Paris,

there is an interface TemplateProvider which can be used to implement different ways of managing templates using the SDK. However, the SDK is not capable to build an openEHR Template from scratch (in an ad-hoc way) but merely to parse and further process any OPT.

Does this help?

Birger

1 Like

Hi @birger.haarbrandt,
But, if for example I have an opt of a template that is not uploaded, it is not possible to upload it from the SDK, right? First I should upload it for example with PostMan and then I can manage it in the SDK, right?

Hi @ian.mcnicoll,
My question is whether you can upload a template directly through the SDK.

@Alex_Paris,

please see the following for an upload function (class + test):

Be aware that the example sets some values in the OPT which is for test purposes only.

Yes, I have already seen that this upload function exists, but I am using the client module and as is a private method I can not access.

1 Like

Was trying to use it and the upload function seems to be not accessible as a public method in the java client

I will check what’s the reason for the method being private.

1 Like