Versions Compared

Key

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

Authentication

API endpoints are authenticated via JWT.

...

security.jwt.token.expireTime=2592000  # 30 days

Endpoint Implementation

Dynamic Endpoints: Invoking an Existing OFBiz Service

To expose an existing OFBiz service as an API, set the following attributes in the service definition:

...

Decoded inParams:

{"idToFind":"GZ-1001"}

Endpoints Implemented as Standard JAX-RS Resources

Endpoints can be implemented as Java classes using the JAX-RS standard.

...

        return Response.status(Response.Status.OK).type(MediaType.APPLICATION_JSON).entity(success).build();
    }
}

Endpoints Defined via XML

RESTful APIs can also be defined using XML files following rest-api.xsd. These XML files must:

...

        <!-- Get party by ID as a sub-operation -->
        <operation verb="get" path="/{idToFind}">
            <service name="findPartiesById"/>
        </operation>
    </resource>
</api>

Miscellaneous Notes

Dependencies:

  • Jersey (JAX-RS implementation) and Jackson (JSON mapping) - Version 2.40
  • Swagger (API documentation) - Version 2.2.20