com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Exposing Data as REST-Style Resources

Introduction

This sample demonstrates how data can be exposed as REST resources through a data service and also how the service can be invoked in REST style.

Building the sample

The sample data service ResourcesSample should be deployed using the instructions in Deploying Data Services section.

Database and service definitions

This sample scenario is based on a database which stores information about the products of an enterprise. There are separate queries/resources written for specific tasks of the products. Resources are defined in order to access data through REST calls. The resources implemented in the service are listed as follows.

    • Create Product - Use HTTP POST request to insert new products.
      Resource Path : product
      Resource Method : POST
    • Update Product - Use HTTP PUT request to update product infomation.
      Resource Path : product
      Resource Method : PUT
    • GET Product - Use HTTP GET request to retreive product infomation for a given product code.
      Resource Path : product/{productCode}
      Resource Method : GET
    • Get All Products - Use HTTP GET request to get all the products.
      Resource Path : products
      Resource Method : GET
    • Delete Product - Use HTTP DELETE request to delete a given product from the database.
      Resource Path : product/{productCode}
      Resource Method : DELETE

Running the sample

The service can be invoked in REST-style via curl (http://curl.haxx.se). The following commands can be executed in command line to invoke each of the resources.

It is possible to receive responses to these requests in JSON format, provided that 'content negation' is enabled in you DSS. Go to Receiving JSON Responses for instructions on how you can enable 'content negotiation' in DSS. After you have enabled this option, you can simple send the same requests given above by adding “Accept:Application/json” to the request header as illustrated below.

curl -X GET -H "Accept:application/json" http://localhost:9763/services/samples/ResourcesSample.HTTPEndpoint/product/S10_1678
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.