Hello!
I have been utilizing the OSMC TWC Rest API (https://osmc.nomagic.com/2021xr2/swagger/index.html) to create/read/update/delete elements.
My goal is to create a class, within that class create several attributes, and each of those attributes will have a value associated with them.
I'm able to do this but it seems that TWC takes forever to process the request and when you have to generate a lot of classes (80+) with each of them having 10+ attributes and values, it can take a really long time to generate each one.
Right now I'm creating the class first, then once I have that, create the attributes, then I create the values. Since each element relies on the ID of the previous, I have to create them in order at least from how I understand the API.
So I wanted to know if it would be possible to create a class, its attributes and its values within one POST request perhaps like so:
{
"@type": "uml:Class",
"kerml:esiData": {
"name": "MyCustomClass",
"owningPackage": {"@id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"},
"attributes": {
{
"name": "MyFirstAttribute",
"value": "MyValue",
"owningClass": {"@id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
},
{
"name": "MySecondAttribute",
"value": "MySecondValue",
"owningClass": {"@id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
},
.
.
.
.
}
},
"kerml:nsURI": "http://www.nomagic.com/magicdraw/UML/2.5.1.1"
}
I'm aware that the above payload is not valid (at least the "attributes" portion) but I just need to know if something like that would even be possible? Or am I simply stuck having to create each element sequentially (i.e. creating the class first, creating the attribute next and attaching it to the class, and creating the value of the attribute and attaching it to the attribute).
Furthermore, if the latter is the case, is there any way to speed up the responses from the TWC server? Currently it seems to take forever for the TWC server to process all the POST requests I send it.
Any help, suggestions, or resources are highly appreciated!