API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#API Connect
#Applicationintegration
#APIConnect
 View Only

how to reference the context variable

  • 1.  how to reference the context variable

    Posted 14 days ago

    Hi, I want to reference the context variable in nano dp, for example, api.endpoint.hostname

    I tried the

    kind: Set
    apiVersion: api.ibm.com/v1
    metadata:
      name: DPNano_Set_QueryParameters
      namespace: DPNano_Product_City
      version: '1'
      tags: []
      labels:
        gatewayTypes:
          - nano
    spec:
      valueType: jsonata
      variable:
        name: queryParams
        value: $(api.endpoint.hostname)
    However, I got internal error.
    I tried LuaScript as:
    request.headers["X-City"] = context.get('api.endpoint.hostname')
    Also, it does not work
    Any suggestion?


    ------------------------------
    Michael Liu
    ------------------------------