I do not understand this error. I do not want to run a test. I just want to perform a simple delete operation in Okta. I have never used Postman before. I can run a list of users using a pre-written Okta collection. Ithen tried the Okta delete uses with a small2-line .csv file and I keep getting this error. Code: [DELETE {{url}}/api/v1/users/{{username}}]. Postman runner Result: āThis request does not have any testsā.
Hey @steve.robey
Welcome to the community!
So the message isnāt an error, itās just informing you that, those particular requests, donāt have any Tests associated with them in the Tests
tab in the Request Builder. It doesnāt impact the Collection run in any way.
The issue that I can see here is that the request is returning a 404 Not Found, as you are using variables {{url}}/api/v1/users/{{username}}
it might be that those are not resolving during runtime.
HI Danny, Thank you for a quick response. I was just looking at the 404 Not found, and I think you are correct and my query is not finding the users. So I need to dive into why this is occurring as I know the two users in the .csv file exist. Okta provides the simplistic code including the name for the variable for the users, but they show it with two different names, once āusernameā and once" userid". I have tried both and the preview of the .csv field looks ok. I have a call with Okta support this morning and although I know that Okta support people want nothing to do with customer code that deletes deactivated users, I hope I can figure out what is wrong. Here is the link to their sparse documentation: https://support.okta.com/help/s/article/How-to-bulk-delete-users-via-Postman,
Are you using the same CSV file from that article or one of your own?
Have you set the {{url}}
variable anywhere else?
It looks like that CSV is only showing the {{username}}
key/value so if the domain part isnāt resolving, it wouldnāt work.
If you click on the request name, in the image you posted, you will get more details about the request - This will show the resolved URL.
You should be seeing something like:
https://example.okta.com/api/v1/users/test1@rares.local
but if thatās like this:
https:///%7B%7Burl%7D%7D/api/v1/users/test1@rares.local
Thatās the issue.
The āurlā looks OK:
But the āusernameā variable is āUnresolvedā. How do I fix this?
Is that the same environment file that you using during the Collection Run?
If youāre using the Collection Runner with a CSV datafile like this:
username
Danny
Steve
Bob
It will resolve that variable at runtime.
If youāre in the Request Builder, like I can see you are, you could add a new username
variable to your environment file with the value of a user you want to Delete and try it out to see if itās working as expected before moving to the runner again.
Hi Danny, you are definitely pointing me in the correct direction. Looking up and using the Using the Okta āuseridā (looks like ā00u3565wcwJQN0pm62p7ā) in the Request builder works. But using the same code to run in the Collections run still cannot find the user. Even my Okta support person was unable to help me yet and will have to get back to me however. In the meantime I am going to punt with postman as I was able to get their PowerShell code to work correctly and delete the 2,800 deactivated users. Iāll post back here if I ever get it to work correctly. The Okta document page that I referenced above is clearly not correct.
Note: I find it is better to use PowerShell to deactivate and/or delete a batch of users since it will deactivate the user and then delete it in a single pass. This script also creates a useful log file. See: delete-users.ps1 found here: https://support.okta.com/help/s/article/How-to-Perform-a-Bulk-Delete-of-Okta-Users-With-API
Reference: https://support.okta.com/help/s/article/How-to-bulk-delete-users-via-Postman
To use Postman, first set up an account. I created an account linked to my persoanl account. Then I set up an environment that I call āOkta Lumileds Productionā with the correct URL and I generated the api key. You should also test your environment with the list user script first. Then I fount Oktaās collections and found the delete user script under Users (Okta API) Ć āLifecycle Operationsā. To successfully run this āDelete Userā script (Under āLumileds above): DELETE {{url}}/api/v1/users/{{username}}
Hover over āLumileds and then click on the āPlayā iconā that appears:
Then Click Run:
This will open a new āCollection Runner Window and log you in in preparation for running the script. Verify the environment and select your .csv file. Example: 20200706_OktaDelDeaUsers.csv, containing:
username
Chandran.Varitharajoo@lumileds.com
Note: this is a deactivated user in Okta:
Click āRun Lumileds to see:
Ignore the āThis request does not have any tests and ā204 no Contentā messages. The results are meaningless to. But the user is deleted:
{
āidā: ā1acc82da-5c3b-40c3-a500-e1814bc93567ā,
ānameā: āLumiledsā,
ātimestampā: ā2020-07-06T19:53:09.134Zā,
ācollection_idā: ā2a5c9dd7-4700-4229-abe7-00ff95b6821eā,
āfolder_idā: 0,
āenvironment_idā: āa04ae03d-b150-4eeb-98bd-2135edd05c59ā,
ātotalPassā: 0,
ātotalFailā: 0,
āresultsā: [
{
āidā: ā5677947d-fdd9-4a22-9c5e-e71c1a2f714cā,
ānameā: āDelete Userā,
āurlā: āhttps://lumileds.okta.com/api/v1/users/Chandran.Varitharajoo@lumileds.comā,
ātimeā: 945,
āresponseCodeā: {
ācodeā: 204,
ānameā: āNo Contentā
},
ātestsā: {},
ātestPassFailCountsā: {},
ātimesā: [
945
],
āallTestsā: [
{}
]
}
],
ācountā: 1,
ātotalTimeā: 945,
ācollectionā: {
ārequestsā: [
{
āidā: ā5677947d-fdd9-4a22-9c5e-e71c1a2f714cā,
āmethodā: āDELETEā
}
]
}
}
Hi All.
I just had exactly the same issue, after running the 404 was being returned. In my case what I did was making the API Call not with runner but just a ānormal API Callā, there I could see more details which finally helped me to solve the issue.
In my case, I need to specify a parameter that must be, letās say: A or B or C. I was specifing type D, so of course, the type D was ā¦ ā¦ ā¦ not found
I hope it helps.