<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z0000AFrPCTCQ3Okta Classic EngineAdministrationAnswered2024-10-01T15:21:39.000Z2024-09-26T03:05:02.000Z2024-10-01T15:21:39.000Z

EricC.41029 (Customer) asked a question.

Anyone having issue with the API to retrieve policy ?

This is the API I'm using api/v1/policies?status=ACTIVE&limit=1&type=OKTA_SIGN_ON&expand=RULES&q=abx but it the limit= and q= doesn't do anything . It's still listing all the policies .


  • Hi @EricC.41029 (Customer)​ , Thank you for reaching out to the Okta Community! 

     

    I just tested it and seems to be working fine for me with the caveat that the order of parameters is important and that the "q" filter works as "startsWith" method, so perhaps that's what is influencing your results. 

     

    I have 3 policies, two of which are ACTIVE and as you can see in the below screenshot, I have two that start with the word "test", one active, one inactive.  

    Add 

     

    I ran the following call and got the expected results: "TEST - MFA only (no password)".  

     

    /api/v1/policies?type=OKTA_SIGN_ON&status=ACTIVE&limit=1&q=test

     

     

     

    If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you. 

     

    Hope my answer helps! 

     

    --

    Help others in the community by liking or hitting Select as Best if this response helped you.

    Expand Post
  • EricC.41029 (Customer)

    Hi , it doesn't work the same for me . I've tried exactly the same order and query string like yours but I'm still getting multiple results . I should be expecting empty result here because there is no policy that contains "test"

    screen2Do you know what could be the issue ?

    Expand Post
    •  

      I'm not sure what is wrong in your configuration for it to result in that.  

      I recommend trying to use the Okta API Collections if you are using POSTMAN to test it by leveraging one of the available calls listed there to see if it makes any difference. 

      For example, I used the "GET Rule" call one under the Policy API collection ( {{url}}/api/v1/policies/{{policyId}}/rules/{{ruleId}} ) and just modified the call to fit my needs with /api/v1/policies?type=OKTA_SIGN_ON&status=ACTIVE&limit=1&q=test

      image 

       

      Regards.

      --

      Help others in the community by liking or hitting Select as Best if this response helped you.

      Expand Post
    • Acknowledged. If you have a paid account with us, I recommend opening a case to work with my colleagues from the Support Team on this.

       

       

      Regards.

      --

      Help others in the community by liking or hitting Select as Best if this response helped you.

      Expand Post
This question is closed.
Loading
Anyone having issue with the API to retrieve policy ?