Generate CarTracker Operations

Provides step-by-step instructions that guide you through the process of generating three operations for the CarTracker service interface.

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

Generate operations
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.
  1. In the Application Explorer view, right-click the CarTracker Web service, and then select New > API Resources from the context menu.
  2. On the list of COBOL groups, uncheck the second and fourth entries on the group list.
  3. Click the cars/car group.

    In the COBOL Group Tree Structure box, you can see the data structures that are mapped to the selected group.

    Notice that both the GET and POST HTTP Methods are checked. Each method generates an operation.

  4. Click the cars/car/feature group.

    For this tutorial, you do not need to get the list of car features, but you do need to send updates. Therefore, you do not need to generate an operation for the GET method.

  5. Uncheck the GET check box under HTTP Methods.
  6. Click Finish.
  7. In the Application Explorer view, expand the CarTracker Web service to see the newly generated operations.
Rename operations
Here you rename the generated operations to better identify what each of them does.
  1. In the Application Explorer view, right-click the GetCarsCars operation, and then select Operation Properties from the context menu.
  2. In the Operation name field, replace GetCarsCars with GetCar, and then click OK.
  3. Similarly, rename PostCarsCar to AddCar, and PostCarsCarFeature to AddCarFeature.
  4. To update the list in the Application Explorer view with the new names, right-click the CarTracker Web service, and then select Refresh from the context menu.