Tips for using the API toolkit for HTTP-to-JSON mapping

You can use the common keyboard and mouse-click actions for your API design needs when you map HTTP request and response to the JSON schema of the service.

zosConnect-2.0 Applies to zosConnect-2.0.

Use the keyboard and the mouse for HTTP to JSON mapping:

  • Drag-and-drop to map data from the HTTP header, path parameter, or query parameters to fields in the service.
  • Right-click to access menus for actions applicable to the selected elements, such as adding/editing a query parameter, assigning a value to a field, or undo a transform action.
  • Use the Control or Shift key to select multiple fields.

The basics

When you open the request mapping, you see the HTTP request on one side and the fields in the service on the other. As an API developer, your primary interest is to map the information from the HTTP request, typically in the header or a parameter to appropriate fields in the service.

If you open the response mapping, you see fields in the service on the left and the HTTP response on the right. As an API developer, your primary interest is to determine what information from the service to send back to the body in the HTTP response. Often times you would remove some fields from the response and send back only needed information.

Transform actions

Designing your API is achieved mostly through the data transform actions:

  • Move: Moves data from the HTTP header, path parameter, or query parameters to appropriate fields in the service.
  • Remove: Hides a field in the service. This action is often used in the response mapping so unnecessary fields are not available to the API for the HTTP response.
  • Assign: Assigns a static value to a field in the service.
  • Task: Specifies a description or detailed documentation for communication purposes.
To move data from the HTTP request to appropriate fields in the service, move your mouse over the element in the HTTP request and drag.
Figure 1. Drag and drop for data mapping
Animation shows how to drag an HTTP request to the service fields.
You can also easily add an HTTP header or a query parameter through the right-click menu.
Figure 2. The right-click menu
Use the right-click menu to add an HTTP header or a query parameter.

If you make a mistake, you can undo or delete your transform action by right-clicking the action and select Delete from the menu.

Selecting multiple fields

To select multiple fields for the same action, you have several options:

  • Select a block of fields by selecting the first field, holding down the Shift key, and clicking the Up or Down arrow to extend the selection.
  • Select a block of fields by drawing a box around the fields with your mouse.
    Figure 3. Selecting a block of fields by drawing a box
    Image shows a block of fields selected by drawing a box around the fields with your mouse.
  • Select multiple fields that are not next to one another by selecting the first field, holding down the Control key, and clicking the other fields that you want to select.
    Figure 4. Selecting multiple fields that are not next to one another by holding down the Control key
    Image shows multiple fields selected by holding down the Ctrl key while selecting with the mouse.