Layer7 API Management

 View Only
  • 1.  make an api

    Posted Jul 22, 2020 11:10 AM
    Make an api
    If I passed Mayank in the json format it should return me ur Surname

    Request -
    {"name":"Mayank"}

    Response -
    {"surname":"Dhoni"}

    Likewise
    Request -
    {"name":"Yash"}

    Response -
    {"surname":"Agarwal"}

    If name is not Deval or Rushikesh then send response

    {"error":"name not found"}

    ------------------------------
    Can anyone tell me how to make this API in the policy manager?
    ------------------------------


  • 2.  RE: make an api
    Best Answer

    Broadcom Employee
    Posted Jul 22, 2020 11:21 AM
      |   view attached
    Hi Deval,

    Can you elaborate a bit on what you are trying to accomplish? Based on the above you could simply look at the incoming JSON and do a compare to see if the name = Mayank and hard code a response. Though I imagine you are looking for a slightly more involved functionally. Is this data stored in a DB or auth provider somewhere that it can be retrieved from?

    If you are just looking for a sample of how to read and respond to a JSON payload I have attached a policy to get you started. 

    Regards,
    Joe

    Attachment(s)

    xml
    deval.xml   2 KB 1 version