CentraSite 10.5 | CentraSite User’s Guide | Asset Management | Managing Assets through Command Line Interface | Importing an Asset | Importing REST Service
 
Importing REST Service
Pre-requisites:
To import a REST Service through the CentraSite Command Line Interface, you must have the CentraSite Administrator role.
CentraSite provides a command tool named import Service to import a REST service using RAML or Swagger file.
*To import a REST Service
*Run the command import Service.
The syntax is of the format: C:\SoftwareAG\CentraSite\utilities>CentraSiteCommand import Service [-url <CENTRASITE-URL>] -user <USER-ID> -password <PASSWORD> [-organization <ORGANIZATION>] -type <TYPE> -serviceUri <SERVICE-URI> [-serviceUser <SERVICE-USER>] [-servicePassword <SERVICE-PASSWORD>] [-update <ASSET-ID>] [-imports <IMPORTS-DESCRIPTOR>] [-batch <BATCH-MODE>]
The input parameters are:
Parameter
Description
CENTRASITE-URL
(Optional). The URL of the CentraSite registry. For example, http://localhost:53307/CentraSite/CentraSite.
USER-ID
The user ID of a registered CentraSite user who has the CentraSite Administrator role. For example, Administrator.
PASSWORD
The password for the CentraSite user identified by the parameter USER-ID.
ORGANIZATION
(Optional). The organization to which the newly imported REST service is long.
TYPE
The type of REST service you want to import. Possible values are:
*RAML - Reads a RAML specification file and from it, creates a REST Service with RAML metadata.
*Swagger - Reads a Swagger specification file and from it, creates a REST Service with Swagger metadata.
SERVICE-URI
The location of a specification file that you want to use for importing the REST service in CentraSite.
*If the import file resides on a remote network, specify its URL.
*If the import file resides on your local system, specify the absolute or relative path to the file. If relative, the path should be relative to the location from where the command is executed.
SERVICE-USER
(Optional). If you have specified a URL in the above parameter SERVICE-URI, and the import file you want to access through the URL requires user authentication, enter a user ID that CentraSite is to use for authentication at the URL site.
SERVICE-PASSWORD
(Optional). The password that CentraSite is to use for authentication at the URL site.
ASSET-ID
(Optional). The ID of the REST service you want to update. You can specify the UDDI key of the service using an optional prefix “uddi:”. For example:
uddi:207ff1cc-25c5-544c-415c-d98ea91060c
IMPORTS-DESCRIPTOR
(Optional). The absolute or relative path to the imports descriptor file that contains all referenced objects to which the RAML/Swagger import file has an association.
The imports descriptor file contains a map of key-value pairs and defines the referenced objects as <import-alias>=<import-uri>.
BATCH-MODE
(Optional). Determines how referenced schemas are handled when the schema that is referred to in the imports descriptor file does not exist in the registry. Possible values are true and false.
*If the parameter value is set to true, then CentraSite ignores any missing referenced schemas.
*If the parameter value is set to false, then you is prompted at runtime to specify the referenced schema file’s location.
The default value is false.
Example (all in one line):
The command for importing a RAML specification into CentraSite with an administrator account INTERNAL\Admin and password AdminPW would be:
C:\SoftwareAG\CentraSite\utilities>CentraSiteCommand.cmd import Service -url http://localhost:53307/CentraSite/CentraSite -user INTERNAL\Admin -password AdminPW -organization “Default Organization” -type RAML -serviceUri C:/include-resource-types.yaml -serviceUser INTERNAL\Claire -servicePassword Clairepwd -imports C:/imports.properties -batch true
The response to this command could be:
Executing the command : import Service
=================================================================
The service has been imported successfully with:
Name: RAML RESTful API
Id: b7377c94-2993-11e5-bad6-e9f07cabfe13
Organization: Default Organization
=================================================================
….
Successfully executed the command : import Service
Note:
To update an existing REST Service in CentraSite, you can use the import Service command and provide an edited specification file as input to the command along with the key that identifies the REST service that you want to update.