Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • API version: 3.3

  • Package version: 3.3.0.23

  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

...

Code Block
languagesh
conda install /some/path/syndeia_cloud_33x_client_sdk-3.3.0.23-py_0.tar.bz2  # ex: for v3.3.0.23, update as appropriate

conda uninstall

...

UserSecurity

  • Type: API key

  • API key parameter name: X-Auth-Token

  • Location: HTTP header

Quickstart

Please refer to the Quickstart section in the documentation included with the SDK

  • parameter name: X-Auth-Token

  • Location: HTTP header

Quickstart

Code Block
languagepy
# - STEP 1.  Import libs -------------------------
from __future__ import print_function
import time
import getpass
import uuid
import syndeia_cloud_33x_client_sdk
from syndeia_cloud_33x_client_sdk.rest import ApiException
from pprint import pprint

# - STEP 2.  Instantiate Configuration object (this is used to set server & credential details) -------------------------
configuration = syndeia_cloud_33x_client_sdk.Configuration()

# - STEP 3.  Set configuration object instance properties --------------------
# Note, if you are unsure of any of the below, contact your Syndeia Cloud server admin 

# configuration.host = "http(s)://host.domain.tld:9000(HTTP)|9443(HTTPS)", ex:  
configuration.host = "<https://mySyndeiaCloudServer.domain.tld:9443"> # -or- "<http://mySyndeiaCloudServer.domain.tld:9000"> if using HTTP

# configuration.username = "username", for LDAP = LDAP "username", for Basic auth = your email address (usually)
configuration.username = "myUsername"

# configuration.password = getpass.getpass()|"myP4$$wD" (prompt for password) | (specify) 
configuration.password = getpass.getpass()

# TLS:  uncomment the below if server is using a self-signed cert, or it isn't in the trust store, or you want to skip SSL validation
# configuration.verify_ssl = False 

# - STEP 4.  Instantiate Syndeia REST ApiClient object with the configuration -----------------------------
api_client_instance = syndeia_cloud_33x_client_sdk.ApiClient(configuration)
# Now, given the api_client_instance, you can instiate any part of the API - AuthAPI, UserAPI, RepositoryAPI, etc.

# - STEP 5.  Authenticate ---------------------------------------------
# Instantiate AuthAPI object
auth_api_instance = syndeia_cloud_33x_client_sdk.AuthApi(api_client_instance)

# IF using LDAP, use the below:  
sign_in_provider_instance = syndeia_cloud_33x_client_sdk.models.SignInProvider(username = configuration.username, password = configuration.password)
authed_instance = auth_api_instance.authenticate_by_provider('LDAP', sign_in_provider_instance)

# ELSE, uncomment and use the below for Basic auth:   
# signin_instance = syndeia_cloud_33x_client_sdk.models.SignIn(username = configuration.username, password = configuration.password, remember_me = False)
# authed_instance = auth_api_instance.sign_in_user(signin_instance)

# grab returned (bearer) token and save in in the configuration object for subsequent requests
configuration.api_key['X-Auth-Token'] = authed_instance.resources.token

# - STEP 6A (optional).  Get all repositories ----------------------------
repository_api_instance = syndeia_cloud_33x_client_sdk.RepositoryApi(api_client_instance)

try:
    # Get all repositories
    repositories_response = repository_api_instance.get_repositories()
    pprint(repositories_response)
except ApiException as e:
    print("Exception when calling RepositoryApi->get_repositories: %s\n" % e)

# print number of repositories
num_repositories = len(repositories_response.resources)
print(num_repositories)

# for all repositories, print repository name (repository host)
for r in repositories_response.resources:
    print(r.name + " ( " + r.host + " ) ")

# - STEP 6B (optional).  Create a test repository ----------------------------
repository_api_instance = syndeia_cloud_33x_client_sdk.RepositoryApi(api_client_instance)
repository_create_instance = syndeia_cloud_33x_client_sdk.RepositoryCreate(gid = str(uuid.uuid4())[:11], 
                                                                       name = 'myRepo of Type Foo by ' + configuration.username, 
                                                                       host = '<https://myRepo.domain.com',> 
                                                                       type = {'name': 'Foo Type'}
                                                                      )

try:
    # Create a new repository
    repository_create_response = repository_api_instance.create_repository(repository_create_instance)
    pprint(repository_create_response)
except ApiException as e:
    print("Exception when calling RepositoryApi->create_repository: %s\n" % e)

# - STEP 7 (optional).  Get containers --------------------------------------
# Instantiate the ContainerAPI
container_api_instance = syndeia_cloud_33x_client_sdk.ContainerApi(api_client_instance)

try:
    container_response = container_api_instance.get_containers()
    print(container_response)
except ApiException as e:
    print("Exception when calling ContainerApi->get_containers: %s\n" % e)

# print number of containers   
num_containers = len(container_response.resources)
print(num_containers)

# print out container name (key)
for c in syndeia_containers:
    print(c.name + " (" + c.key + ")")

# - STEP 8 (optional).  Get artifacts --------------------------------------
# Instantiate the ArtifactAPI
artifact_api_instance = syndeia_cloud_33x_client_sdk.ArtifactApi(api_client_instance)

try:
    artifact_response = artifact_api_instance.get_artifacts()
    print(artifact_response)
except ApiException as e:
    print("Exception when calling ArtifactApi->get_artifacts: %s\n" % e)

# print number of artifacts
num_artifacts = len(artifact_response.resources)
print(num_artifacts)

# - STEP 9 (optional).  Get relations --------------------------------------
# Instantiate the RelationAPI
relation_api_instance = syndeia_cloud_33x_client_sdk.RelationApi(api_client_instance)

try:
    relation_response = relation_api_instance.get_relations()
    print(relation_response)
except ApiException as e:
    print("Exception when calling RelationApi->get_relations: %s\n" % e)

# Number of relations
num_relations = len(relation_response.resources)
print(num_relations)

# Get relations by specific Syndeia projects
# Get the Syndeia container with key UAV_MBEE
uav_relations = relation_api_instance.get_relations_by_container_key("UAV_MBEE")

num_uav_relations = len(uav_relations.resources)
print(num_uav_relations)

for r in uav_relations.resources:
    print(r.key + " - " + r.name)

Documentation for API Endpoints

...

Class

Method

HTTP request

Description

ArtifactApi

create_artifact

POST /artifacts

Create a new artifact

ArtifactApi

delete_artifacts_by_key

DELETE /artifacts/{key}

Delete an artifact given the artifact key

ArtifactApi

get_artifact_by_external_id

POST /artifacts/external/id

Get an artifact given the artifact external id

ArtifactApi

get_artifact_by_key

GET /artifacts/{key}

Get an artifact given the artifact key

ArtifactApi

get_artifact_by_key_and_version

GET /artifacts/{key}/versions/{version}

Get an artifact given the artifact key and version

ArtifactApi

get_artifact_versions_by_key

GET /artifacts/{key}/versions

Get all versions of an artifact given the artifact key

ArtifactApi

get_artifacts

GET /artifacts

Get all artifacts

ArtifactApi

update_artifact_by_key

PUT /artifacts/{key}

Update artifact given the artifact key

ArtifactTypeApi

create_artifact_type

POST /types/artifact

Create a new Artifact type

ArtifactTypeApi

delete_artifact_type_by_key

DELETE /types/artifact/{key}

Delete an Artifact type given the Artifact type key

ArtifactTypeApi

get_artifact_type_by_external_id

POST /types/artifact/external/id

Get an artifact type given the artifact type external id

ArtifactTypeApi

get_artifact_type_by_key

GET /types/artifact/{key}

Get an Artifact type given the Artifact type key

ArtifactTypeApi

get_artifact_type_by_key_and_attribute_definition_id

GET /types/artifact/{key}/attribdefs/{id}

Get an attribute definition of an artifact type given the artifact type key and attribute definition id

ArtifactTypeApi

get_artifact_types

GET /types/artifact

Get all artifact types

ArtifactTypeApi

update_artifact_type_by_key

PUT /types/artifact/{key}

Update an Artifact type given the Artifact key

AuthApi

create_super_user

GET /signUp/superuser

Sign-up super user

AuthApi

create_user

POST /signUp

Create a new user (sign-up)

AuthApi

diable_internal_user

POST /account/disable

Disable internal user

AuthApi

enable_internal_user

POST /account/enable

Enable internal user

AuthApi

get_new_password

POST /password/reset

Reset user password

AuthApi

get_token

POST /signIn

Sign-in a user

AuthApi

get_token_by_provider

POST /authenticate/{provider}

Authenticate user through Auth Provider e.g LDAP

AuthApi

sign_out_user

GET /signOut

Sign-out a user

AuthApi

update_password

POST /password/change

Change user password

ContainerApi

create_container

POST /containers

Create a new container

ContainerApi

delete_container_by_key

DELETE /containers/{key}

Delete a container given the container key

ContainerApi

get_container_by_external_id

POST /containers/external/id

Get a container given the container external id

ContainerApi

get_container_by_key

GET /containers/{key}

Get a container given the container key

ContainerApi

get_containers

GET /containers

Get all containers

ContainerApi

update_container_by_key

PUT /containers/{key}

Update a container given the container key

ContainerTypeApi

create_container_type

POST /types/container

Create a new Container type

ContainerTypeApi

delete_container_type_by_key

DELETE /types/container/{key}

Delete a Container type given the container type key

ContainerTypeApi

get_container_type_by_external_id

POST /types/container/external/id

Get a container type given the container type external id

ContainerTypeApi

get_container_type_by_key

GET /types/container/{key}

Get a Container type given the Container type key

ContainerTypeApi

get_container_type_by_key_and_attribute_definition_id

GET /types/container/{key}/attribdefs/{id}

Get a attribute definition of container type given the container type key and attribute definition id

ContainerTypeApi

get_container_types

GET /types/container

Get all container types

ContainerTypeApi

update_container_type_by_key

PUT /types/container/{key}

Update a Container type given the Container key

GraphApi

get_raw_graph_result

POST /graph/query/raw

Get result of a graph query

RelationApi

create_relation

POST /relations

Create a new relation

RelationApi

delete_relations_by_key

DELETE /relations/{key}

Delete a relation given the relation key

RelationApi

get_relation_by_external_id

POST /relations/external/id

Get a relation given the relation external id

RelationApi

get_relation_by_key

GET /relations/{key}

Get a relation given the relation key

RelationApi

get_relation_by_key_and_version

GET /relations/{key}/versions/{version}

Get a relation given the relation key and version

RelationApi

get_relation_versions_by_key

GET /relations/{key}/versions

Get all versions of a relation given the relation key

RelationApi

get_relations

GET /relations

Get all relations

RelationApi

update_relation_by_key

PUT /relations/{key}

Update relation given the relation key

RelationTypeApi

create_relation_type

POST /types/relation

Create a new Relation type

RelationTypeApi

delete_relation_type_by_key

DELETE /types/relation/{key}

Delete a Relation type given the Relation type key

RelationTypeApi

get_relation_type_by_external_id

POST /types/relation/external/id

Get a relation type given the relation type external id

RelationTypeApi

get_relation_type_by_key

GET /types/relation/{key}

Get a Relation type given the Relation type key

RelationTypeApi

get_relation_type_by_key_and_attribute_definition_id

GET /types/relation/{key}/attribdefs/{id}

Get an attribute definition of relation type given the relation type key and attribute definition id

RelationTypeApi

get_relation_types

GET /types/relation

Get all relation types

RelationTypeApi

update_relation_type_by_key

PUT /types/relation/{key}

Update a Relation type given the Relation key

RepositoryApi

create_repository

POST /repositories

Create a new repository

RepositoryApi

delete_repository_by_key

DELETE /repositories/{key}

Delete a repository given the repository key

RepositoryApi

get_repositories

GET /repositories

Get all repositories

RepositoryApi

get_repository_by_external_id

POST /repositories/external/id

Get a repository given the repository external id

RepositoryApi

get_repository_by_key

GET /repositories/{key}

Get a repository given the repository key

RepositoryApi

update_repository_by_key

PUT /repositories/{key}

Update a repository given the repository key

RepositoryTypeApi

create_repository_type

POST /types/repository

Create a new repository type

RepositoryTypeApi

delete_repository_type_by_key

DELETE /types/repository/{key}

Delete a repository type given the repository type key

RepositoryTypeApi

get_repository_type_by_external_id

POST /types/repository/external/id

Get a repository type given the repository type external id

RepositoryTypeApi

get_repository_type_by_key

GET /types/repository/{key}

Get a repository type given the repository type key

RepositoryTypeApi

get_repository_type_by_key_and_attribute_definition_id

GET /types/repository/{key}/attribdefs/{id}

Get a attribute definition of repository type given the repository type key and attribute definition id

RepositoryTypeApi

get_repository_types

GET /types/repository

Get all repository types

RepositoryTypeApi

update_repository_type_by_key

PUT /types/repository/{key}

Update a repository type given the repository key

UserApi

delete_user_by_ key

DELETE /users/{key}

Delete a user given the user key

UserApi

get_user_by_key

GET /users/{key}

Get a user given the user key

UserApi

get_user_by_username

GET /users/username/{username}

Get a user given the user name

UserApi

get_users

GET /users

Get all users

UserApi

update_user_by_key

PUT /users/{key}

Update a user given the user key

...

  • Intercax DevTeam,

  • OpenAPI

2020-0408-13T1105T00:0551:51 36 ET, brian