TASKPM/scripts/rest-clients
2011-07-01 09:49:46 +02:00
..
calendar-exception-type-sample.xml Exception type web services. 2010-10-13 16:32:17 +02:00
calendars-sample.xml Fixed example of calendars service. 2010-09-18 13:38:51 +02:00
cost-categories-sample.xml Fixed example of cost categories service in order to use the same codes than work hours types example. 2010-09-18 13:38:57 +02:00
criterion-types-sample.xml ItEr46S13CUImportacionRecursosProductivosItEr45S11: First version of the generic REST service and CriterionServiceREST reimplemented in terms of it. 2010-02-05 12:25:36 +01:00
criterion-types-update-sample.xml ItEr46S13CUImportacionRecursosProductivosItEr45S11: First version of the generic REST service and CriterionServiceREST reimplemented in terms of it. 2010-02-05 12:25:36 +01:00
export-calendar-exception-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-calendars.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-cost-categories.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-criterion-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-label-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-material-categories.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-orders.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-resources-hours.sh Tidy not mandatory for example REST scripts. 2011-06-19 16:51:15 +02:00
export-resources.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-type-work-hours.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-unit-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export-work-reports.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
export.sh Tidy not mandatory for example REST scripts. 2011-06-19 16:51:15 +02:00
get-xml-schema.sh Updated script to get REST XML schema to new variables for environments. 2011-06-19 15:33:21 +02:00
import-calendar-exception-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-calendars.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-cost-categories.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-criterions-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-label-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-material-categories.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-orders.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-resources.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-type-work-hours.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-unit-types.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import-work-reports.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
import.sh Tidy not mandatory for example REST scripts. 2011-06-19 16:51:15 +02:00
label-sample.xml ItEr49S18AdaptacionServiciosREST: Fixes the LabelServiceREST. 2010-03-04 18:08:53 +01:00
material-categories-sample.xml Fixed material categories service, updated examples and documentation. 2010-09-18 13:39:00 +02:00
order-sample.xml Fixed orders service examples and documentation. 2010-09-20 11:07:07 +02:00
order-update-sample.xml Fixed orders service examples and documentation. 2010-09-20 11:07:07 +02:00
orders-sample.xml Replaced tabs for 4-spaces in several files. 2011-07-01 09:49:46 +02:00
README [doc] Fixed small things in web services basic documentation. 2011-06-28 16:27:37 +02:00
resource-withCalendars-sample.xml ItEr55S07AdaptacionServiciosRESTItEr54S09: Fixed type in hors-per-day instead of hours-per-day. 2010-04-26 13:50:13 +02:00
resources-sample-mini.xml ItEr46S13CUImportacionRecursosProductivosItEr45S11: code added to entities imported by ResourceService. 2010-02-05 18:27:01 +01:00
resources-sample.xml ItEr47S12CUImportacionRecursosProductivosItEr46S13: Added updating functionality to ResourceServiceREST 2010-02-12 10:53:54 +01:00
resources-update-sample.xml ItEr47S12CUImportacionRecursosProductivosItEr46S13: Added updating functionality to ResourceServiceREST 2010-02-12 10:53:54 +01:00
rest-common-env.sh Now rest clients use demo deployment by default and have 2 new options --prod and --dev. 2011-06-09 10:38:37 +02:00
type-work-hours-sample.xml ItEr60S04ValidacionEProbasFuncionaisItEr59S04 : Fixing bug in the type of work hours class. 2010-07-09 13:49:01 +02:00
unit-types-sample.xml Fixed material categories service, updated examples and documentation. 2010-09-18 13:39:00 +02:00
work-reports-sample.xml Replaced tabs for 4-spaces in several files. 2011-07-01 09:49:46 +02:00

Web Services
============

.. sectnum::

:Author: Manuel Rego Casasnovas
:Contact: rego@igalia.com
:Date: 28/06/2011
:Copyright:
  Some rights reserved. This document is distributed under the Creative
  Commons Attribution-ShareAlike 3.0 licence, available in
  http://creativecommons.org/licenses/by-sa/3.0/.
:Abstract:
  Basic documentation about NavalPlan web services usage.


.. contents:: Table of Contents


Introduction
------------

Inside ``scripts/rest-clients/`` folder of NavalPlan source code, you can find
several scripts to test NavalPlan web services. There are web services for
most import entities in the application. And if needed more could be easily
developed.

All *integration entities* (NavalPlan entities that can be exported and/or
imported) has a common attribute called ``code``. This field would be the one
used to share information between NavalPlan and other systems or other NavalPlan
instances.

NavalPlan web services are REST based. But, they are just using two HTTP
methods with the following meaning:

* ``GET``: Used to extract information from NavalPlan. For each case they will
  return a list with all the entities. For example, resources web service will
  return a list with all application resources.

  This is current behaviour for ``GET`` services, but it could be expanded to
  just return one entity sending the code as a GET parameter.

* ``POST``: Used to add and update information in NavalPlan. These services will
  receive a XML file with a list of entities. For each entity there could be 2
  different cases:

  * If it already exists: Update entity with new data.
  * If it does not exist: Add the new entity.

These means that delete is not allowed from web services, in that way only new
info could be added or updated. This is because of entities are related with
others and remove operation could be dangerous. Then if necessary, the
recommendation would be add a field to disable such entity.


Requirements
------------

These scripts are written in bash so you need to be running a bash terminal to
use them.

Moreover, it is recommended to have Tidy available in your system. You can
install it with the following command in Debian based distributions::

  # apt-get install tidy

In openSUSE with::

  # zypper install tidy

Or in Fedora with::

  # yum install tidy


Default credentials
-------------------

In order to test these scripts you will need an user with reader and writer
permissions for web services of NavalPlan. Default credentials are:

* Reader permission:

  * User: ``wsreader``
  * Password: ``wsreader``

* Writer permission:

  * User: ``wswriter``
  * Password: ``wswriter``


Common parameters
-----------------

There are already defined several parameters to be used in the scripts to define
the server to execute the tests:

Demo environment (``without parameters``) - default

  Use server where demo is launched using the following URL:
  ``http://demo.navalplan.org/navalplan-demo/``

  Example::

    $ ./export-resources.sh

Production environment (``--prod``)

  Use server deployed with Tomcat in a production deployment in the following
  URL: ``http://localhost:8080/navalplan/`` (the installation done by Debian
  package).

  Example::

    $ ./export-resources.sh --prod

Development environment (``--dev``)

  Use server deployed with Jetty during development in the following URL:
  ``http://localhost:8080/navalplanner-webapp/``

  Example::

    $ ./export-resources.sh --dev


XML Schemas
-----------

To get XML schema use the following script::

  $ get-xml-schema.sh <service-path>

Example::

  $ get-xml-schema.sh resources


Export scripts
--------------

There several scripts to just get information from NavalPlan system. They always
start with ``export-`` prefix. These scripts usually don't need any parameter
(apart from the one to select the environment). They will return a XML output
with the data requested.

Example::

  $ ./export-resources.sh


Import scripts
--------------

As for the previous point, in order to insert data in NavalPlan system thought
web services there are several scripts with prefix ``import-``. In this case,
these scripts need a special parameter, that would be a XML file with data to be
inserted in NavalPlan. There are usually files with ``-sample`` suffix as
example data. Again, output for these scripts is a XML message with the possible
errors trying to insert the data in the system.

Example::

  $ ./import-resources.sh resources-sample.xml