User:Sarah/EMS Server Extensions

From RAD Studio
Jump to: navigation, search

An EMS Package is a new package that extends the functionality of the EMS server.

An EMS Package extends the functionality of an EMS server by registering resources and resources endpoints. A resource extends the existing REST API of the EMS Server, adding new functionalities to it. These resource endpoints may be called by EMS clients.

Note: Each resource endpoint handles a different kind of HTTP request to the EMS Server. Only typical HTTP method for REST services are allowed, such as GET, PUT, POST and DELETE. For more information, see DataSnap REST.

A resource in an EMS Package can expose the following endpoints:

Endpoint Description

Get()

The Get endpoint is called using an HTTP GET.

GetItem()

The GetItem endpoint is called using HTTP GET.
The segment at the end of the URL identifies the item to get.

Post()

The Post endpoint is called using an HTTP POST.

PutItem()

The PutItem endpoint is called using HTTP PUT.
The segment at the end of the URL identifies the item to put.

DeleteItem()

The DeleteItem endpoint is called using HTTP DELETE.
The segment at the end of the URL identifies the item to delete.


Creating an EMS Package

You can create a new EMS package by running the EMS Package Wizard, as follows:

  1. Open the EMS Package Wizard:
    • For Delphi: Open File > New > Other > Delphi project > EMS > EMS Package
    • For C++: Open File > New > Other > C++Builder project > EMS > EMS Package
  2. Select the type of package extension you are creating:
    • Empty package. An empty package does not register a resource in the EMS Server. You can choose it if and add the resource later.
    • Create package with resource. Creates a package with a resource that will extend the REST API of the EMS Server.
    Note: If you are creating a new Empty Package, select finish the wizard.
  3. Enter additional resource information:
    • Name. The name of the created resource.
    • File type. Select if you want to implement the resource using a designer and components (Data Module) or in code (Unit).
  4. Select the Endpoints methods that you want to add to your resource.
  5. Click the Finish button.

After finishing the wizard, you need to implement the resource endpoint methods as you want.

You can add additional modules to and existing EMS Package to extend the functionality of the EMS Server by registering new resources.

  1. Open the EMS Module Wizard:
    • For Delphi: Open File > New > Other > Delphi project > EMS > EMS Module
    • For C++: Open File > New > Other > C++Builder project > EMS > EMS Module
  2. Enter the new resource information:
    • Name. The name of the created resource.
    • File type. Select if you want to implement the resource using a designer and components (Data Module) or in code (Unit).
  3. Select the Endpoints methods that you want to add to your resource.
  4. Click the Finish button.