Layer7 API Management

  • 1.  How to fetch numbers from query url and perform basic arithmetic operations on them?

    Posted Mar 22, 2019 03:00 AM

    my url: /calculator/operations?a=5&b=10

    required output: 15 (eg. addition)

     

    Have converted the string to integer but not able to operate on them?! 



  • 2.  Re: How to fetch numbers from query url and perform basic arithmetic operations on them?

    Broadcom Employee
    Posted Mar 22, 2019 08:02 AM

    Good morning,

     

    XPath can be used to perform certain mathematical operations. I have included a link below with examples.

    Alternatively, we do have a tactical assertion for math operations, this can be requested by opening a support case.

     

    Mathematical functions within Policy - CA Knowledge 

     

    Regards,

    Joe



  • 3.  Re: How to fetch numbers from query url and perform basic arithmetic operations on them?

    Broadcom Employee
    Posted Mar 22, 2019 10:21 AM

    The JavaScript assertion is perfect for these kind of operations.



  • 4.  Re: How to fetch numbers from query url and perform basic arithmetic operations on them?

    Broadcom Employee
    Posted Mar 24, 2019 07:04 PM

    There is also a tactical assertion EvaluateMathExpression Assertion, which can be used to evaluate complex mathematical expressions.