/SysML-v2-API-Java-Client

Java client software for the Systems Modeling API.

Primary LanguageJavaGNU Lesser General Public License v3.0LGPL-3.0

sysml-v2-api-client

SysML v2 API and Services

  • API version: 1.0.0

REST/HTTP binding (PSM) for the SysML v2 standard API.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>org.omg.sysml</groupId>
  <artifactId>sysml-v2-api-client</artifactId>
  <version>2020-09</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "org.omg.sysml:sysml-v2-api-client:2020-09"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/sysml-v2-api-client-2020-09.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import org.omg.sysml.ApiClient;
import org.omg.sysml.ApiException;
import org.omg.sysml.Configuration;
import org.omg.sysml.models.*;
import org.omg.sysml.api.CommitApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");

    CommitApi apiInstance = new CommitApi(defaultClient);
    UUID projectId = new UUID(); // UUID | ID of the project
    UUID commitId = new UUID(); // UUID | ID of the commit
    try {
      Commit result = apiInstance.getCommitByProjectAndId(projectId, commitId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CommitApi#getCommitByProjectAndId");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
CommitApi getCommitByProjectAndId GET /projects/{projectId}/commits/{commitId} Get commit by project and ID
CommitApi getCommitsByProject GET /projects/{projectId}/commits Get commits by project
CommitApi getHeadCommitByProject GET /projects/{projectId}/head Get head commit by project
CommitApi postCommitByProject POST /projects/{projectId}/commits Create commit by project
ElementApi getElementByProjectCommitId GET /projects/{projectId}/commits/{commitId}/elements/{elementId} Get element by project, commit and ID
ElementApi getElementsByProjectCommit GET /projects/{projectId}/commits/{commitId}/elements Get elements by project and commit
ElementApi getRootsByProjectCommit GET /projects/{projectId}/commits/{commitId}/roots Get root elements by project and commit
ProjectApi getProjectById GET /projects/{projectId} Get project by ID
ProjectApi getProjects GET /projects Get projects
ProjectApi postProject POST /projects Create project
QueryApi getQueriesByProject GET /projects/{projectId}/queries Get queries by project
QueryApi getQueryByProjectAndId GET /projects/{projectId}/queries/{queryId} Get query by project and ID
QueryApi getQueryResultsByProjectIdQuery GET /projects/{projectId}/query-results Get query results by project and query definition
QueryApi getQueryResultsByProjectIdQueryId GET /projects/{projectId}/queries/{queryId}/results Get query results by project and query
QueryApi getQueryResultsByProjectIdQueryPost POST /projects/{projectId}/query-results Get query results by project and query definition via POST
QueryApi postQueryByProject POST /projects/{projectId}/queries Create query by project
RelationshipApi getRelationshipsByProjectCommitRelatedElement GET /projects/{projectId}/commits/{commitId}/elements/{relatedElementId}/relationships Get relationships by project, commit, and related element

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization. Authentication schemes defined for the API:

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author