I’m struggling to find a way to export tags through the SDK, in the same fashion as the system.tag.exportTags script function. Is there a straight forward way of doing this? I’m pretty new to all of this.
I can get the TagProvider through the gateway context, and I see that there’s the importTagsAsync method, but no export. I’m trying to export all the datatypes from a given tag provider. My closest guess was something like:
TagPath typesPath = TagPathParser.parse("_types_"); List<TagPath> tagPaths = new ArrayList<TagPath>(); tagPaths.add(typesPath); CompletableFuture<List<TagConfigurationModel>> cfTagModels = gatewayContext.getTagManager().getTagProvider(providerName).getTagConfigsAsync(tagPaths, true, true); List<TagConfigurationModel> tModels =cfTagModels.get(); TagConfigurationModel tModel = tModels.iterator().next(); Gson gson = new Gson(); String typesJson = gson.toJson(tModel);
As I was pretty sure of beforehand, this didn’t magically give me the json format I was looking for. Any ideas of how I should be going about exporting tags?