I'm looking for a way to cancel a pending send through the SOAP API in Marketing Cloud. I can use the Soap API to get a list of Send objects (using the object 'Send') and I can see that the IDs here correspond to the Job IDs of pending sends (as well as cancelled sends and completed sends) in my SFMC account. I can't work out how to ask SMFC to cancel the send though. Sorry if I'm missing something really obvious here
1 Answer
There's example soap for this here: here
To cancel a send it has to have a 'cancel' operation performed on it. This is not included in the ruby sdk by default but it can be added by opening the class, adding the send object and defining a cancl method like this:
module FuelSDK
class Send < Objects::Base
include Objects::Soap::Read
include Objects::Soap::CUD
attr_accessor :folder_id
def cancel
perform_response = client.soap_perform id, 'cancel', properties
if perform_response.status then
@last_task_id = perform_response.results[0][:result][:task][:id]
end
perform_response
end
end
end
This has the effect of reopening the class to add something in, adding send as an object you can do the usual API create/update/search things on and additionally defines a cancel method you can call on the send