Delete a campaign
Deletes a 10DLC campaign from your account. This action is irreversible and is only allowed for campaigns that have no numbers in processing status.
API Endpoint
DELETE
https://api.plivo.com/v1/Account/{auth_id}/Campaign/{campaign_id}/
Arguments
No arguments need to be passed.
Returns
api_id, campaign_id, and a confirmation (or error message).
Response
HTTP Status Code: 200
{
"api_id" : "d899b83a-7464-11ed-9120-0242ac110003" ,
"campaign_id" : "CTPC3HL" ,
"message" : "Campaign Deactivated"
}
Example Request
1
2
3
4
5
6
7
import sys
sys . path . append ( "../plivo-python" )
import plivo
client = plivo . RestClient ( "<auth_id>" , "<auth_token>" )
bresponse = client . campaign . delete ( campaign_id = '<Campaign_id>' )
print ( bresponse )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require "rubygems"
require "/etc/plivo-ruby/lib/plivo.rb"
include Plivo
api = RestClient . new ( "<auth_id>" , "<auth_token>" )
begin
puts ( 'Delete Campaign' )
response = api . campaign . delete ( "<Campaign_ID>" )
puts response
rescue PlivoRESTError => e
puts 'Exception: ' + e . message
end
1
2
3
4
5
6
7
8
9
10
let plivo = require ( ' plivo ' );
let fs = require ( ' fs ' );
let client = new plivo . Client ( " <auth_id> " , " <auth_token> " );
client . campaign . deleteCampaign ( " <Campaign_ID> " ). then ( function ( response ) {
console . log ( JSON . stringify ( response ));
}). catch ( function ( error ) {
console . log ( " err " );
console . log ( error );
});
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
require '/etc/plivo-php/vendor/autoload.php' ;
use Plivo\RestClient ;
$client = new RestClient ( "<auth_id>" , "<auth_token>" );
$client -> client -> setTimeout ( 60 );
try {
$res = $client -> campaign -> delete ( "<Campaign_ID>" );
print_r ( $res );
}
catch ( PlivoRestException $ex ) {
print_r ( $ex );
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.io.IOException ;
import com.plivo.api.Plivo ;
import com.plivo.api.exceptions.* ;
import com.plivo.api.models.campaign.Campaign ;
import com.plivo.api.models.campaign.CampaignDeleteResponse ;
public class PlivoTest {
public static void main ( String [] args ) {
Plivo . init ( "<auth_id>" , "<auth_token>" );
// Get Brand Details
try
{
CampaignDeleteResponse response = Campaign . deleter ( "<Campaign_id>" ). delete ();
System . out . println ( response );
}
catch ( PlivoRestException | IOException | PlivoValidationException e )
{
e . printStackTrace ();
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System ;
using Plivo ;
using Plivo.Exception ;
namespace test
{
class Program
{
static void Main ( string [] args )
{
var api = new PlivoApi ( "<auth_id>" , "<auth_token>" );
try
{
Console . WriteLine ( "Delete Campaign" );
var campaign_delete_response = api . Campaign . Delete ( "<Campaign_id>" );
Console . WriteLine ( campaign_delete_response );
}
catch ( PlivoRestException e )
{
Console . WriteLine ( "Exception: " + e . Message );
}
}
}
}
1
2
curl --location --request DELETE 'https://api.plivo.com/v1/Account/<auth_id>/10dlc/Campaign/<Campaign_ID>/' \
--header 'Authorization: Basic XXXX=='
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main
import (
"fmt"
"os"
plivo "github.com/plivo/plivo-go/v7"
)
func main () {
client , err := plivo . NewClient ( "<auth_id>" , "<auth_token>" , & plivo . ClientOptions {})
if err != nil {
panic ( err )
}
// Delete Campaign
response , err := client . Campaign . Delete ( "<Campaign_ID>" )
if err != nil {
fmt . Printf ( "Error occurred while deleting camapign. error:%+v \n " , err )
os . Exit ( 1 )
} else {
fmt . Printf ( "%+v \n " , response )
}
}
Example Request
1
2
3
4
5
6
7
import sys
sys . path . append ( "../plivo-python" )
import plivo
client = plivo . RestClient ( "<auth_id>" , "<auth_token>" )
bresponse = client . campaign . delete ( campaign_id = '<Campaign_id>' )
print ( bresponse )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require "rubygems"
require "/etc/plivo-ruby/lib/plivo.rb"
include Plivo
api = RestClient . new ( "<auth_id>" , "<auth_token>" )
begin
puts ( 'Delete Campaign' )
response = api . campaign . delete ( "<Campaign_ID>" )
puts response
rescue PlivoRESTError => e
puts 'Exception: ' + e . message
end
1
2
3
4
5
6
7
8
9
10
let plivo = require ( ' plivo ' );
let fs = require ( ' fs ' );
let client = new plivo . Client ( " <auth_id> " , " <auth_token> " );
client . campaign . deleteCampaign ( " <Campaign_ID> " ). then ( function ( response ) {
console . log ( JSON . stringify ( response ));
}). catch ( function ( error ) {
console . log ( " err " );
console . log ( error );
});
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
require '/etc/plivo-php/vendor/autoload.php' ;
use Plivo\RestClient ;
$client = new RestClient ( "<auth_id>" , "<auth_token>" );
$client -> client -> setTimeout ( 60 );
try {
$res = $client -> campaign -> delete ( "<Campaign_ID>" );
print_r ( $res );
}
catch ( PlivoRestException $ex ) {
print_r ( $ex );
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.io.IOException ;
import com.plivo.api.Plivo ;
import com.plivo.api.exceptions.* ;
import com.plivo.api.models.campaign.Campaign ;
import com.plivo.api.models.campaign.CampaignDeleteResponse ;
public class PlivoTest {
public static void main ( String [] args ) {
Plivo . init ( "<auth_id>" , "<auth_token>" );
// Get Brand Details
try
{
CampaignDeleteResponse response = Campaign . deleter ( "<Campaign_id>" ). delete ();
System . out . println ( response );
}
catch ( PlivoRestException | IOException | PlivoValidationException e )
{
e . printStackTrace ();
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System ;
using Plivo ;
using Plivo.Exception ;
namespace test
{
class Program
{
static void Main ( string [] args )
{
var api = new PlivoApi ( "<auth_id>" , "<auth_token>" );
try
{
Console . WriteLine ( "Delete Campaign" );
var campaign_delete_response = api . Campaign . Delete ( "<Campaign_id>" );
Console . WriteLine ( campaign_delete_response );
}
catch ( PlivoRestException e )
{
Console . WriteLine ( "Exception: " + e . Message );
}
}
}
}
1
2
curl --location --request DELETE 'https://api.plivo.com/v1/Account/<auth_id>/10dlc/Campaign/<Campaign_ID>/' \
--header 'Authorization: Basic XXXX=='
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main
import (
"fmt"
"os"
plivo "github.com/plivo/plivo-go/v7"
)
func main () {
client , err := plivo . NewClient ( "<auth_id>" , "<auth_token>" , & plivo . ClientOptions {})
if err != nil {
panic ( err )
}
// Delete Campaign
response , err := client . Campaign . Delete ( "<Campaign_ID>" )
if err != nil {
fmt . Printf ( "Error occurred while deleting camapign. error:%+v \n " , err )
os . Exit ( 1 )
} else {
fmt . Printf ( "%+v \n " , response )
}
}
🥳 Thank you! It means a lot to us!
Help Us Improve
Thank you so much for rating the page, we would like to get your input
for further improvements!
Thank you for your feedback!