banty01

Team Development using LAC 4.1

Blog Post created by banty01 Employee on Mar 29, 2018

Team Development in 4.1

CA Live API Creator (LAC) 4.1 released a new set of features for developers to collaborate and integrate changes into a central SCS (Source Control System).  While previous versions support the export of an entire API as a single JSON file, many developers found the format difficult to navigate since the structure reflected the internal database storage.  This meant that JavaSciprt, HTML, SQL, and JSON were all intermixed into this large JSON file. In addition, user JavaScript libraries had to be exported and imported using a separate process.

 

In 4.1, the developer can choose to export a single JSON file which includes user libraries or a ZIP file which can be exploded and checked directly into a your SCS.  The new JSON format will list individual files for JSON, SQL, HTML, and JavaScript which makes merge/compare much easier.  The new JSON definition is also meant to be more human readable and consistent across all objects. The exploded ZIP file format reflects each of the main areas of LAC and can be easily copied between developers and re-combined and imported into different servers.  Many of the details can be seen in the CA internal WIKI here.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NodeJS Admin Command Line 

The NodeJS tool used by devops to connect to LAC and export/import is called lacadmin (see documentation) . The original command used to import and export API [lacadmin project export] has been deprecated (it will still work but uses the 4.0 style) and replaced with [lacadmin api export] and [lacadmin api import].  The new 'api' command uses the  new @export and @import endpoints.  These have a number of new arguments shown below:  (see documentation)

Usage: API [options] <list|create|update|delete|use|import|export|extract>   
Administer APIs. Actions are: list, create, update, delete, use, export   
  -h, --help                                                                      output usage information      
  --ident [ident]                                                                 The ident of the specific API (see: lacadmin api list).      
  --api_name [name]                                                               The name of the API.       --url_name [name]                                                               The url fragment name of the API.      
  --status [status]                                                               optional: create or update the status of the API, can be A (for Active) or I for (Inactive).      
  --authprovider [ident]                                                          optional: create or update the ident of the authentication provider for the API.      
  --comments [comments]                                                           optional: create or update a description of the API.      
  --section [name]                                                                optional: Export Only -The named section of the API you wish to export (e.g. resources, functions, datasources).      
  --section_filter [filter]                                                       optional: Export Only -The section filter of the API you wish to export (name=foo&version=v1).      
  -d, --directory [directory]                                                     Required for extract, the name of a directory to extract ZIP files.      
  -f, --file [file]                                                               optional: for import/export/extract, the name of a file to read from/save to, if unspecified, use stdin/stdout.      
  --format [json|zip]                                                             optional: for import/export, this sets the output type of the export default: json.      
  --namecollision [fail|rename_new|replace_existing|disable_and_rename_existing]  optional: for import, determines how to handle existing API projects(default rename_new).      
  --errorhandling [standard|fail_on_warning|best_efforts]                         optional: for import, sets the error level response handling (default: standard.      
  --passwordstyle [skip|encrypted|plaintext]                                      optional: for export, sets the password style of exported API datasources (default: skip).      
  --librarystyle [emit_all|in_use_only]                                           optional: for export, sets the library style  (default: emit_all).      
  --apioptionsstyle [emit_all|skip_default]                                       optional: for export, sets the api options (default: emit_all).      
  --synchronize [replace|merge]                                                   optional: Export only- Used only by extract to synchronize zip file with directory folder (default: merge) replace will remove root directory contents and replace with zip contents.      
  -v, --verbose                                                                   optional: whether to display detailed results, or just a summary.

One of the features above is called 'section' which allows the export of a single sub-directory (lacadmin api export --section resources).  Which can be further reduced down to a specific named object using the 'section_filter' (lacadmin api export --section resources --section_filter "name=AllCustomers").  Examples for each can be found here.

 

TeamSpace ExportRepos

One of the new features of the lacadmin command line tool allows the devops person to export the entire content of a TeamSpace (this is a new concept in 4.1 found here).  This will export the entire set of API's for the TeamSpace user into a single ZIP file (which can then be imported into another TeamSpace or LAC Server).

 

$lacadmin login -u admin -p Password1 http://localhost:8080  -a jetty

$lacadmin use jetty

$lacadmin teamspace exportRepos --file ALL_PROJECTS.zip --format zip --passwordstyle encrypted

 

 #Create a new TeamSpace for a user: dev1 password mypassw

 

$lacadmin login -u dev1 -p mypassw http://localhost:8080  -a qa

$lacadmin use qa

$lacadmin api import --file ALL_PROJECTS.zip --namecollision replace_existing

Outcomes