Generate CarTracker Operations

Provides step-by-step instructions that guide you through the process of generating three operations for the CarTracker service interface.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

Unlike for other types of service interfaces, operations for JSON RESTful interfaces can be generated automatically by the Interface Mapper. In this section, you use the Interface Mapper to generate three operations based on the COBOL definitions found in CarProgram.cbl.

  1. In the Interface Mapper, right-click the Operation banner at the top of the right pane, and select New from the context menu.
  2. Leave the Name field blank.
  3. On the Select program/copybook list, select CarsProgram.

    The name of each entry point contained in the program appears farther down on the dialog box.

  4. On the Select entry point list, click CARSPROGRAM.

    The entry point code appears to its right.

  5. Click Enable API Resources.

    This enables the API Resources tab, where you can select further options.

    API Resources
    Note: For a description of each field and control on this tab, see Operation Properties - API Resources tab.

    In this tutorial, you want to generate three operations - one to retrieve a list of all cars in the collection, one to add a new car to the collection, and one to add a feature to a car already in the collection.

  6. In the left-most column, uncheck the second and fourth resources.
  7. In the Path/Methods column of the third resource, uncheck GET.

    This leaves a POST and GET operation for the first resource, and a POST operation for the third resource.

  8. Click OK.
  9. In the Interface Mapper, click the Operation drop-down list.

    This now shows three operations, one for each HTTP method that was checked on the API Resources tab: GetCars, AddCar, and AddCarFeature.

    Notice also that for each operation, its defined HTTP Method/Path specification appears on the banner to its right. When accessing the Web service, Enterprise Server uses the path specification to determine which operation to launch.

    Note: For more information about path specifications, see Operation Paths.
  10. From the Visual Studio main menu, click File > Save CarTracker.svi to save the service interface.