Making a Traffic Call

To make a traffic call:

Procedure

  1. Get the traffic endpoint by running the following command for local k8s. This will print the IP. For newer versions of kubectl, such as 1.11, replace $2 with $3 in the command.
    kubectl get svc | grep "tm-svc" | awk -F' ''{print $2}'
    You can also get the IP from k8s dashboard. Click on the Services tab on the left panel and search for tm-svc. Note down the corresponding Cluster IP. This is the IP you will use to make the Traffic Manager call.

  2. Go to the shell of any container other than tml-tm and do the curl call as follows. The endpoint and API key in the following curl call corresponds to the sample data.zip attached above.
    curl -v -H 'Host:chainsproxy.api.momtest.example.com''http://<IP from step 1>/v1/api/patient/1234/qatest/testRequestInfo.php?api_key=3bvu8u3p8k5vjxmhrs6tnd6e'
    A successful call should give output similar to the following:
    TIME NOW: 2018-09-1814:43:41
    ================================
    Server Script: /internal/patients/1234/info/qatest/testRequestInfo.php
    Query params: api_key=3bvu8u3p8k5vjxmhrs6tnd6e
    Request Method: GET
    Request Protocol: HTTP/1.1
    Requested URI: /internal/patients/1234/info/qatest/testRequestInfo.php?api_key=3bvu8u3p8k5vjxmhrs6tnd6e
    REQUEST HEADERS:
    Array
    (
        [host] => content.mock.example.com
        [Accept] => */*
        [User-Agent] => Mashery Proxy
        [X-Original-User-Agent] => curl/7.51.0
        [X-Forwarded-For] => x.x.1.1, x.x.223.93
        [X-Forwarded-Port] => 80
        [X-Forwarded-Proto] => http
        [Connection] => keep-alive
    )
  3. The following sample curl is from AWS deployment and MOM sync mechanism was used. Ideally, curl in step 2 and 3 should return the same output:
    curl -v -H'Host:api.example.com''http://a6c10dbf4ae0b11e886b6063d52d7762-1137774647.us-east-1.elb.amazonaws.com/v1/api/patient/1234/qatest/testRequestInfo.php?api_key=3bvu8u3p8k5vjxmhrs6tnd6e'