Adding an endpoint with the Get method type

Use the Get method to retrieve information from an API.

  1. Sign in to the Rhythm website as a site editor or tenant administrator.
  2. Click the Menu button.
  3. Click the Control Panel tab.
  4. Click Generic API.
  5. Click the name of the API.
  6. Click Add Endpoint.
  7. In the Incoming URL field, specify the last part of the URL that the generic wrapper uses to identify the endpoint. This value must be unique in the tenant.
  8. Click the Get method type.
  9. In the Parameter Template field, optionally specify json code that retrieves key values that you can include in the GET call to the ION API. You can use these types:
    Lookup
    Use this replacement type to look up a value from another API to use in the GET call.
    {
        "customerID": {
            "type": "lookup",
            "call": "/delegate/ecom-api/users/current",
            "path": "$.activeUserGroup.customerNumber"
        }
    }

    In the sample code, /delegate/ecom-api/users/current is called. In the results, the user ID that was passed from the API wrapper is searched for in the activeUserGroup key. The value in the customerNumber key is returned. If the value in the customerNumber key is ABC-123, then the template results in this json:

    {
    "customerID": "ABC-123"
    }
    This table shows the components of the sample json template:
    Component Description
    "customerID" The key to use for the result of the json call.
    "type" The type of replacement. Specify "type":"lookup".
    "call" The call to the API that you are using to look up information. The value that you specify is appended to the base URL for your Rhythm server.
    "path" The json path expression to use to look up a value in the result of the call. Specify an expression that returns one result.
    Input
    Use this replacement type to input a value from the data that was passed from the API wrapper.
    {
        "itemID": {
            "type": "input",
            "path": "$.itemNumber"
        }
    }

    In the sample code, the data that was passed from the API wrapper is searched for the itemNumber key. If the value in the itemNumber key is 12345, then the template results in this json:

    {
    "itemID": "12345"
    }
    This table shows the components of the sample json template:
    Component Description
    "itemID" The key to use for the result of the json call.
    "type" The type of replacement. Specify "type":"input".
    "path" The json path expression to use to look up a value in the data sent in the API wrapper. Specify an expression that returns one result.
    Static value
    Use this template to send a specific value in the API call.
    {
        "color": "blue"
    }

    In the sample code, blue is also sent in the color key.

  10. In the URL Template field, specify the endpoint to call. If you specified information in the Parameter Template field, include the key in brackets. For example, specify /example/{itemID}
  11. Click Save.