Network/tutorials/quick-start-bundle

From CubeiaWiki

Jump to: navigation, search

Contents

Installing and running the quickstart bundle

The quickstart bundle is a standalone packaging of the user service, wallet service and the backoffice application in an Apache Tomcat container.

1 minute install

IMPORTANT NOTE: The bundle currently won't work on Java 1.7. Use Java 1.6 instead.

  1. download and unpack the bundle
  2. change working directory to: apache-tomcat-x.y.z
  3. start tomcat with ./bin/startup.sh (Unix) or \bin\startup.bat (Windows)
  4. access the backoffice by visiting: http://localhost:8080/backoffice-web
  5. log in with user: admin, password: admin

Complete! Now you should have a working Cubeia Network. See the next section for some examples of how to add some test data.

Testing it out

Get an overview of available graphical interface URL's here: http://localhost:8080

The User Service REST API is located at URL: http://localhost:8080/user-service-rest/rest The Wallet Service REST API is located at URL: http://localhost:8080/wallet-service-rest/rest

To add some test users to the user service you can modify and run the included shell script doc/create-users.sh.

A good way to explore the REST api:s is to use a REST client GUI [1][2][3] or the command line tool curl.

The full API documentation can be found here [4].

Some examples with curl (note: the below examples work on Unix, for Windows see curl on windows):

Example 1: Getting a user by id

curl -XGET http://localhost:8080/user-service-rest/rest/user/id/1003

Example 2: Create a user

curl -XPOST -H "Content-type: application/json" http://localhost:8080/user-service-rest/rest/users -d '
{
  "user" : {
    "userName" : "snubben",
    "operatorId" : "1",
    "userInformation" : {
      "billingAddress" : "Norrgatan 13",
      "city" : "Stockholm",
      "country" : "Sweden"
    }
  },
   "password" : "pwd"
}'

Example 3: Search for a user with screen name starting with "snu"

curl -XPUT -H "Content-type: application/json" http://localhost:8080/user-service-rest/rest/users/search/query -d '
{
  "screenName" : "snu%",
  "order": "ID",
  "ascending" : "false",
  "queryLimit" : "10",
  "queryOffset" : "0"
}'

TIP: If you are using curl have Python v2.6 or later installed you might want format the returned JSON by piping the output to python -mjson.tool.

Configuration overview

Datasources are configured as JNDI-resources in: <TOMCAT_HOME>/conf/Catalina/localhost/user-service-rest.xml and <TOMCAT_HOME>/conf/Catalina/localhost/wallet-service-rest.xml. The default configuration uses a H2 database with file storage. The database files are located in the db directory relative to the current working directory when starting tomcat.

Service URL:s used by the backoffice application are configured in <TOMCAT_HOME>/lib/backoffice.properties.

Backoffice users are configured in <TOMCAT_HOME>/lib/backoffice-user-list.xml.

More information can be found at:

Personal tools