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.
- In the
COBOL Explorer, right-click the
CarTracker Web service, and then select
New > API Resources from the context menu.
- On the list of COBOL groups, uncheck the second and fourth entries on the group list.
- 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.
- 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.
- Uncheck the
GET check box under
HTTP Methods.
- Click
Finish.
- In the
COBOL Explorer, 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.
- In the
COBOL Explorer, right-click the
GetCarsCars operation, and then select
Operation Properties from the context menu.
- In the
Operation name field, replace
GetCarsCars with
GetCar, and then click
OK.
- Similarly, rename
PostCarsCar to
AddCar, and
PostCarsCarFeature to
AddCarFeature.
- To update the list in the
COBOL Explorer with the new names, right-click the
CarTracker Web service, and then select
Refresh from the context menu.