Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

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

...

yourmoduleid

...

/

...

*

Getting the REST Web Services Jar into your project

See 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 Block
titlemain 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 
}
Code Block
titleomod 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 

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

see the reportingrest module for an example module exposing web services.

The documentation on how to create methods is the same as for the core developers.  See that page for more information.