How to generate id in API

I’m using ansible to call the API to configure notifications.
I need to create id’s for notifications, which I then need to use in notification definitions. Does anyone know a safe way to generate the ID’s?

Hello,

I haven’t found a way yet, I believe this maybe internal once the notification is created.

Example of searching for notification in MongoDb.

{ "_id" : ObjectId("5d8c264583d72e7aecc513ea"), "title" : "Logged in  After Hours" }
Type "it" for more
>  db.notifications.find({},{"title":1,"ObjectId":1});
>

Example of searching for event_notificationsin MongoDb.

> db.event_notifications.find({},{"title":1,"ObjectId":1});
{ "_id" : ObjectId("5d57348a83d72e833582c3ed"), "title" : "Linux Failed Authorization Login " }
{ "_id" : ObjectId("5d57348b83d72e833582c3f4"), "title" : "Account Lock Out     " }
{ "_id" : ObjectId("5d57348b83d72e833582c3fa"), "title" : "Logs Were Cleared " }
{ "_id" : ObjectId("5d57348b83d72e833582c400"), "title" : "Windows User Failed Logon Attempt      " }
{ "_id" : ObjectId("5d57348b83d72e833582c406"), "title" : "Disk I/O Retried Alert" }
{ "_id" : ObjectId("5d57348b83d72e833582c40c"), "title" : "Windows: Server Name cannot be Resolved" }
{ "_id" : ObjectId("5d57348b83d72e833582c412"), "title" : "Warning Device /Disk Timed out" }
{ "_id" : ObjectId("5d57348c83d72e833582c419"), "title" : "Nextcloud Failed Login" }
{ "_id" : ObjectId("5d57348c83d72e833582c41f"), "title" : "Domain Controller May Be Corrupted" }
{ "_id" : ObjectId("5d57348c83d72e833582c425"), "title" : "Lab-DC5 DNS Errors" }
{ "_id" : ObjectId("5d57348c83d72e833582c42b"), "title" : "Lab-DC5 DFS Replication Errors" }
{ "_id" : ObjectId("5d57348c83d72e833582c433"), "title" : "Lab-DC5 Directory Service Errors" }
{ "_id" : ObjectId("5d57348c83d72e833582c439"), "title" : "Lab-DC5 Time Service Warning " }
{ "_id" : ObjectId("5d57348c83d72e833582c43f"), "title" : "Lab-DC5 Time Service Error" }
{ "_id" : ObjectId("5d57348c83d72e833582c445"), "title" : "Microsoft Certificate  is about to expire or has already expired." }
{ "_id" : ObjectId("5d71cb7283d72e04c0b33078"), "title" : "Linux user Modification " }
{ "_id" : ObjectId("5d77266683d72e7e4776db4e"), "title" : "Windows: User Logon" }
{ "_id" : ObjectId("5d796be283d72e7e477b26df"), "title" : "Windows: Service Failed Authentication Attempt" }
{ "_id" : ObjectId("5d8971e683d72e04cba6aff1"), "title" : "Windows: USB was Detected on Device " }
{ "_id" : ObjectId("5d8c264583d72e7aecc513ea"), "title" : "Logged in  After Hours" }
Type "it" for more
>

It’s possible to use pymongo or pybson to generate object id’s (they’re just mongo object id’s)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.