Layer7 API Management

Expand all | Collapse all

Issues consuming the Live Creator's Published API Project in API Gateway

Jump to Best Answer
  • 1.  Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-24-2016 02:24 AM

    Hi,

     

    I have recently published a set of APIs from Live Creator to my API Gateway. I am able to consume the APIs from Live creator directly. However, when I try to consume them via the gateway, the only API i am able to consume is the @docs endpoint (https://hostname:8443/demo/v1/@docs). The other endpoints which I try to consume e.g. (https://hostname:8443/demo/v1/@docs) will always result in the following error:

     

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

    <soapenv:Body>

    <soapenv:Fault>

    <faultcode>soapenv:Server</faultcode>

    <faultstring>Policy Falsified</faultstring>

    <faultactor>

    https://nodehost:8443/demo/v1/demo:customer?auth=demo_full:1

    </faultactor>

    <detail>

    <l7:policyResult xmlns:l7="http://www.layer7tech.com/ws/policy/fault" status="No Error"/>

    </detail>

    </soapenv:Fault>

    </soapenv:Body>

    </soapenv:Envelope>

     

    May i know is there a way to get around this issue? Thanks for your help.

     



  • 2.  Re: Issues consuming the Live Creator's Published API Project in API Gateway
    Best Answer

    Posted 10-24-2016 06:42 PM

    Hi,

    All parameters must be url-encoded. From the response, it seems the endpoint is not url-encoded.

    And the "auth=demo_full:1" seems not a valid value.

     

    Regards,

    Mark



  • 3.  Re: Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-25-2016 06:01 AM

    Hi Mark,

     

    I tried to call the endpoint through postman https://nodehost:8443/demo/v1/demo:customer with basic authentication but it is still giving me the following error:

     

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

    <soapenv:Body>

    <soapenv:Fault>

    <faultcode>soapenv:Server</faultcode>

    <faultstring>Policy Falsified</faultstring>

    <faultactor>

    https://nodehost:8443/demo/v1/demo:customer

    </faultactor>

    <detail>

    <l7:policyResult xmlns:l7="http://www.layer7tech.com/ws/policy/fault" status="No Error"/>

    </detail>

    </soapenv:Fault>

    </soapenv:Body>

    </soapenv:Envelope>

     

    May I know how do you guys normally call the APIs that were published from LAC to gateway? Cause right now only https://nodehost:8443/demo/v1/@docs seem to be working.

     

    Thanks for your help



  • 4.  Re: Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-25-2016 08:42 PM
      |   view attached

    I attach a sample policy.

    To make it work,

    1. the resolution path of policy needs to be /lac/*  

    otherwise you need to change the regex in the policy

    2. change the context variable lachost to your lac server hostname and port.

    3. the simple policy doesn't url-encode the parameters, so when the client(such as a browser) send the request, it needs to be url-encoded, like this,

    Attachment(s)

    zip
    lac-example.xml.zip   872B 1 version


  • 5.  Re: Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-27-2016 03:35 AM

    Hi Mark,

     

    Thanks!



  • 6.  Re: Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-27-2016 05:09 AM

    Hi Mark,

     

    So i tried out the different methods (GET, POST, PUT and DELETE) via the API GW using the policy given. For some reason, when i tried the PUT method, the response was always Checksum not found - a checksum is required for all updates even though i have already included checksum in the query. 

     

    Thanks for your help.



  • 7.  Re: Issues consuming the Live Creator's Published API Project in API Gateway

    Posted 10-27-2016 08:00 PM

    The PUT is for update, the checksum should be in payload. 

    If you GET the same object, the checksum will be in the "@metadata".

    An easy way is to GET the object you want to update first, copy the response to the payload of PUT, modify only the attribute you want to change, and PUT to update that attribute.