
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.
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.
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"
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
Regards.
--
Help others in the community by liking or hitting Select as Best if this response helped you.
Hi , I've found out the issue , seems like Okta Version 2024.09.1 C is able to reproduce this while Version 2024.09.1 E is working fine . I guess we will have to wait for Okta version upgrade
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.