Azure API Management - Issues with using BigInt on Inbound policy rules

Vivek Komarla Bhaskar 936 Reputation points
2023-07-19T15:39:34.5133333+00:00

Hi,

In my Azure API management inbound policy, I have the following code that checks whether the input is numerical. The code works when the numeric length is 9 or lower, but not when the length is 10. The code does not allow bigint and I tried to change it, but it appears it is not supported.

Screenshot 2023-07-18 at 4.59.26 pm

Below are the input examples:
583176219

583176224

583176217

583176221

2147908970

2149197176

2149197177

2223568491

2223573837

2223573855

2223573858

2161800464

583176220

583965897

583176206

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,295 questions
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,401 Reputation points
    2023-07-19T19:37:54.8833333+00:00

    Vivek Komarla Bhaskar Thanks for posting your question in Microsoft Q&A. The above highlighted values are outside the range of Int32.MaxValue. So, you can try changing it to Int64 instead of int in your policy expression like below:

    string value = "2147908970";
    Int64 numericValue;
    bool isNumber = Int64.TryParse(value, out numericValue);
    return numericValue;
    

    I hope this helps and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.