Layer7 API Management

 View Only
  • 1.  Service additional properties

    Posted May 23, 2024 05:57 PM

    Hi,

    We're heavily using and rely on Service's additional properties as to get per-API basis information that we use in run-time and also when we send metrics to our Splunk indexes.

    Example:

    What we would like to achieve is to modify some values using API calls.

    • Interacting with DB directly is I guess not recommended as anyway modifications are not taken into effect as service is already in cache. Tried it, not working.
    • restman/graphan export/import of the entire service would be overkill

    Is there any other possiblity ?



  • 2.  RE: Service additional properties

    Broadcom Employee
    Posted May 23, 2024 07:15 PM

    Phillippe,

    Restman can do more than just export/import.

    Review the documentation at /restman/1.0/doc/restDoc.html#1.0/services:

    Update Or Create

    Creates or Updates an existing service. If a service with the given ID does not exist one will be created, otherwise the existing one will be updated.
    Request
    PUT 1.0/services/{id}
    Path Parameters
    Param Type Description
    id string ID of the service to create or update
    Query Parameters
    Param Type Default Since Description
    active boolean true Should the service be activated after the update.
    versionComment string The comment to add to the policy version when updating the service
    Body
    Service to create or update
    Element l7:Service
    Content-Type application/xml

    To test this, I just used /restman/1.0/services?name=<name of service> to get the current configuration of my service.

    Then I updated it using /restman/1.0/services/<service id> with the body like:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <l7:Service
    	xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
    			<l7:ServiceDetail folderId="0000000000000000ffffffffffffec76" id="0952e16ec0b6fc84e2356af446b20cca" version="3">
    				CONTENTS FROM PREVIOUS QUERY
    				UPDATING THE PROPERTY DESIRED
    			</l7:ServiceDetail>
    	    <l7:Resources>
    				CONTENTS FROM PREVIOUS QUERY
    			</l7:Resources>
    </l7:Service>
    
    I was able to change and add values like this.  Hope that helps.



  • 3.  RE: Service additional properties

    Broadcom Employee
    Posted May 23, 2024 07:17 PM
    That looks far better on the site.

    --
    This electronic communication and the information and any files transmitted
    with it, or attached to it, are confidential and are intended solely for
    the use of the individual or entity to whom it is addressed and may contain
    information that is confidential, legally privileged, protected by privacy
    laws, or otherwise restricted from disclosure to anyone else. If you are
    not the intended recipient or the person responsible for delivering the
    e-mail to the intended recipient, you are hereby notified that any use,
    copying, distributing, dissemination, forwarding, printing, or copying of
    this e-mail is strictly prohibited. If you received this e-mail in error,
    please return the e-mail to the sender, delete it from your computer, and
    destroy any printed copy of it.




  • 4.  RE: Service additional properties

    Posted May 23, 2024 08:30 PM

    Yes, what I meant by export/import was indeed fetching service through restman and updating it.

    This is the "overkill" part, and what we want ultimately is being able to create a service on the API gateway that could update any service additional properties.

    By overkill, meaning we have to update the complete service definition including the xml part.

    An internal call to restman through "REST Manage Gateway" assertion could be made to fetch service, then play around with some XPATH + XSLT for transformation, then another internal restman call to update, but seems sub-optimal.... and prone to errors, with potential risk of messing up with all current published services :)




  • 5.  RE: Service additional properties

    Broadcom Employee
    Posted May 24, 2024 01:50 AM

    Neither RESTMAN nor GRAPHMAN supports managing the service properties outside of service entity CRUD operations. Possibly, a good candidate for taking it to the next level by voting it.

    Until now, as stated in this thread, I recommend going by special service abstracting the service details to properties using RESTMAN/GRAPHMAN assertion.

    @Ben Urbanski @Francois Lascelles




  • 6.  RE: Service additional properties

    Broadcom Employee
    Posted May 24, 2024 01:53 PM

    Makes sense, knowing that these properties are leveraged as described. Has my vote 👍