Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan_Gillette
Explorer
Jump to solution

add-batch-objects idempotency

I am using the API command add-batch-objects and I'd like to figure out a way to make it idempotent. That is, if an object exists with the same name, do nothing/move on. Currently, the command will create all of the objects I tell it and end up creating a new object with the same name which creates a validation error and ruins the process.

Prior to this call, I was just using individual calls which could ignore the fact that an object exists and move on. My hope was to discontinue this in favor of the batch call.

Does anyone know a way that I can take advantage of the add-batch-objects single call or a crafty way to find and delete the duplicates that were created to speed up my playbook?

0 Kudos
1 Solution

Accepted Solutions
Yael_G
Employee
Employee

Hi @Evan_Gillette ,

Errors and warnings are ignored when using this API but you can find and delete the duplicates that were created by following these steps:

  1. use "show-validations" command to find the duplicated object names.
  2. run "show-session" to get the current session id.
  3. execute "show-changes" command with the parameter "to-session" with the current session to get the objects ids of the duplicated objects.
  4. use the "delete-objects-batch" with the relevant ids.

Regards,

Management API team.

View solution in original post

0 Kudos
2 Replies
Yael_G
Employee
Employee

Hi @Evan_Gillette ,

Errors and warnings are ignored when using this API but you can find and delete the duplicates that were created by following these steps:

  1. use "show-validations" command to find the duplicated object names.
  2. run "show-session" to get the current session id.
  3. execute "show-changes" command with the parameter "to-session" with the current session to get the objects ids of the duplicated objects.
  4. use the "delete-objects-batch" with the relevant ids.

Regards,

Management API team.

0 Kudos
Evan_Gillette
Explorer

That is pretty crafty. I think all of the additional calls make the benefits moot for my purposes. Thank you for the response!

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events