Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
This guide walks a _module_ developer through adding a new set of web service methods for a core object. There is a separate guide for [core developers

...

Conventions

The first thing to do is to read through the conventions section on the REST Web Services API page.  Your module should follow similar conventions.

...

|projects:Adding a Web Service Step by Step Guide for Core Developers].

h2. Conventions

The first thing to do is to read through the conventions section on the [projects:REST Web Services API] page.  Your module should follow similar conventions.

Your REST URLs should be exposed as /ws/rest/

...

_yourmoduleid

...

Getting the REST Web Services Jar into your project

TODO

Adding new Web Service URLs

Info

Our best-practices may change over the course of the sprint as we learn new things, but see the reportingrest module for an example module exposing web services.

...

_/_\*_


h2. Getting the REST Web Services Jar into your project

See [docs:Requiring another module in your module]

Ideally by the time you are reading this the restws module has been uploaded into OpenMRS's maven repository and you can simply add a few dependencies in your pom.xml files:

{code title=main pom.xml file additions}
<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>webservices.rest-api</artifactId>
  <version>1.0</version>
  <type>provided</type>
</dependency>
<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>webservices.rest</artifactId>
  <version>1.0</version>
  <type>provided</type>
</dependency>
{code}

{code title=omod project pom.xml file additions}
<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>webservices.rest-api</artifactId>
  <version>1.0</version>
  <type>jar</type>
</dependency>
<dependency>
  <groupId>org.openmrs.module</groupId>
  <artifactId>webservices.rest</artifactId>
  <version>1.0</version>
  <type>jar</type>
</dependency>
{code}


h2. Adding new Web Service URLs

{info}Our best-practices may change over the course of the sprint as we learn new things, but see the&nbsp;[reportingrest module|http://source.openmrs.org/browse/Modules/reportingrest] for an example module exposing web services.{info}
The documentation on how to create methods is the same as [for the core developers|projects:Adding a Web Service Step by Step Guide for Core Developers].&nbsp; See that page for more information.