Prerequisites

    The REST API classes are tested with , Jersey and as the JAX-RS implementation.Furthermore, the engine classes and Jackson’s artifact (as well as transitive Jackson dependencies) have to be on the classpath.

    Required Steps

    Step 1: Add the REST API to your project as a Maven dependency.

    Step 2: Add the REST resources that you need to your JAX-RS application. Example:

    1. @ApplicationPath("/")
    2. public class MyApplication extends Application {
    3. @Override
    4. Set<Class<?>> classes = new HashSet<Class<?>>();
    5. // add your own classes
    6. ...
    7. // add all camunda engine rest resources (or just add those that you actually need).
    8. classes.addAll(CamundaRestResources.getResourceClasses());
    9. // mandatory
    10. return classes;
    11. }

    CamundaRestResources.getResourceClasses() contains two JAX-RS resources that serve as the entry points. One of these (org.camunda.bpm.engine.rest.impl.NamedProcessEngineRestServiceImpl) provides all of the REST resources listed in this document on paths beginning with /engine/{name} while the other (org.camunda.bpm.engine.rest.impl.DefaultProcessEngineRestServiceImpl) provides access to the default engine’s resources on the root path /.

    The configuration class JacksonConfigurator is required to correctly configure the serialization of date fields.You may also have to add the following Jackson providers: com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider,org.camunda.bpm.engine.rest.exception.JsonMappingExceptionHandler and org.camunda.bpm.engine.rest.exception.JsonParseExceptionHandler.Depending on the runtime environment, this may not be necessary.On JBoss AS 7/Wildfly 8 these should be automatically added as an implicit module dependency.

    For proper exception responses of the format as described in the Introduction,it is necessary to include RestExceptionHandler. ProcessEngineExceptionHandler is used to translate any exception thrown by theengine that is not explicitly handled by the REST API classes to a generic HTTP 500 error with the same response body format.If you would like to have all kinds of exceptions translated to this format, you can use org.camunda.bpm.engine.rest.exception.ExceptionHandler instead of ProcessEngineExceptionHandler.