Hello,
I am trying to use the SysML v2 REST API to create and populate a SysML project programmatically, but I cannot figure out how to create the initial root package using only the REST API.
Creating a new project as described in the API cookbook (Create a new project) works fine. This creates the project, default branch, and initial commit.
After that:
- Calling the
empty_sysmlv2 GraphQL action works and creates the initial model.
- Using the SysON UI ("Create a new model") also works.
- Once the initial package exists, I can successfully create additional packages and other model elements underneath it using the REST
/commits endpoint by creating the appropriate OwningMembership relations.
The remaining problem is bootstrapping the very first top-level package via REST.
From inspecting the model created by SysON, I can see that the root package is owned by the root Namespace through an OwningMembership. However, in an empty project I cannot determine the identity of that root Namespace. The REST endpoints (/elements, /roots, etc.) do not return any elements after project creation, so there is no existing element that I can reference when creating the initial ownership relation.
I also experimented with creating a standalone Package, a standalone OwningMembership, and combinations of both in a commit, but these objects are not persisted unless they are connected to an already existing model element as it seems to me.
My question is:
Is there currently a standard REST API workflow for creating the very first top-level package in an empty project, or is model initialization intentionally expected to be performed through the empty_sysmlv2 GraphQL action (or another SysON-specific mechanism)?
Ultimately, I would like to build a client that relies only on the standardized SysML v2 REST API, without depending on SysON-specific GraphQL operations.
Best regards,
Daniel
Hello,
I am trying to use the SysML v2 REST API to create and populate a SysML project programmatically, but I cannot figure out how to create the initial root package using only the REST API.
Creating a new project as described in the API cookbook (Create a new project) works fine. This creates the project, default branch, and initial commit.
After that:
empty_sysmlv2GraphQL action works and creates the initial model./commitsendpoint by creating the appropriateOwningMembershiprelations.The remaining problem is bootstrapping the very first top-level package via REST.
From inspecting the model created by SysON, I can see that the root package is owned by the root
Namespacethrough anOwningMembership. However, in an empty project I cannot determine the identity of that rootNamespace. The REST endpoints (/elements,/roots, etc.) do not return any elements after project creation, so there is no existing element that I can reference when creating the initial ownership relation.I also experimented with creating a standalone
Package, a standaloneOwningMembership, and combinations of both in a commit, but these objects are not persisted unless they are connected to an already existing model element as it seems to me.My question is:
Is there currently a standard REST API workflow for creating the very first top-level package in an empty project, or is model initialization intentionally expected to be performed through the
empty_sysmlv2GraphQL action (or another SysON-specific mechanism)?Ultimately, I would like to build a client that relies only on the standardized SysML v2 REST API, without depending on SysON-specific GraphQL operations.
Best regards,
Daniel