API
  • API Index
  • Batch API
  • Content Negotiation
  • Dynamic Paths
  • Hierarchy API
  • List API
  • Quick Reference
  • Time Series API
  • Views
    • Configuration
  • Overview
  • Application Configuration
  • Documentation Configuration
  • Spec Configuration
    • Features
  • API Testing
  • Asynchronous Processing
  • Cassandra Time-Series Engine
  • Cassandra Integration
  • Default Controller Customisation
  • Documentation
  • Geospatial Filtering
  • Model Documentation
  • PostgreSQL Integration
  • Excel Spreadsheet Format
    • Tutorials
  • Step-by-Step Guide
  • Archetype Setup
  • Logging
  • Prometheus
  • Sentry Logging
    • UI Customisation
  • UI Customisation
  • SASS Build Chain
  • Shared Layout
  • API Documentation
  • Model Documentation
  • Results
  • sapi-nt v current

    The sapi-nt-archetype Maven archetype is recommended for initialising new sapi-nt projects. It includes an “empty” sapi-nt application, the basic resource directory layout, and an API test class.

    If you initialise your sapi-nt application from the archetype, you will be able to set up and configure almost all aspects of your API simply by creating and editing the configuration and spec files.

    Configuration

    In order to use the archetype, you must first make it accessible by adding the Epimorphics Maven repositories to your Maven settings file. This file is usually located at ${user.home}/.m2/settings.xml.

    Example

    <settings>
     ...
     <profiles>
       ...
       <profile>
         <id>myprofile</id>
         <repositories>
           <repository>
             <id>epi-public-s3-snapshot</id>
             <name>Epimorphics S3 snapshot repository</name>
             <url>https://s3-eu-west-1.amazonaws.com/epi-repository/snapshot</url>
             <releases>
               <enabled>false</enabled>
             </releases>
             <snapshots>
               <enabled>true</enabled>
             </snapshots>
           </repository>
           <repository>
             <id>epi-public-s3-release</id>
             <name>Epimorphics S3 release repository</name>
             <url>https://s3-eu-west-1.amazonaws.com/epi-repository/release</url>
             <releases>
               <enabled>true</enabled>
             </releases>
             <snapshots>
               <enabled>false</enabled>
             </snapshots>
           </repository>
         </repositories>
       </profile>
       ...
     </profiles>
    
     <activeProfiles>
       <activeProfile>myprofile</activeProfile>
     </activeProfiles>
     ...
    </settings>
    

    Usage

    Once the repositories are configured, you can run the following command to initialise a new sapi-nt project in your current directory:

    mvn archetype:generate -DarchetypeGroupId=com.epimorphics -DarchetypeArtifactId=sapi-nt-archetype -DarchetypeVersion={version}
    

    Maven will prompt you for a groupId, artifactId, version and package.

    Property Description
    groupId The group ID of your new project artifact.
    artifactId The ID of your new project artifact.
    version The initial version of your project.
    package The full name of the package to which to add the sapi-nt application code.

    After you have supplied the necessary parameters, a new project will be generated in a subdirectory named after the provided artifactId.

    Example

    $ mvn archetype:generate -DarchetypeGroupId=com.epimorphics -DarchetypeArtifactId=sapi-nt-archetype -DarchetypeVersion=0.1.1
    ...
    Define value for property 'groupId': com.company.project
    Define value for property 'artifactId': new-api
    Define value for property 'version' 1.0-SNAPSHOT: :
    Define value for property 'package' com.company.project: :
    Confirm properties configuration:
    groupId: com.company.project
    artifactId: new-api
    version: 1.0-SNAPSHOT
    package: com.company.project
     Y: :
    [INFO] ----------------------------------------------------------------------------
    [INFO] Using following parameters for creating project from Archetype: sapi-nt-archetype:0.0.1-SNAPSHOT
    [INFO] ----------------------------------------------------------------------------
    ...
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 07:22 min
    [INFO] Finished at: 2018-07-18T09:53:54+02:00
    [INFO] Final Memory: 16M/212M
    [INFO] ------------------------------------------------------------------------