Knowledgebase

Update Broadcast

Method: PUT
Endpoint: /api/updateBroadcast/{id}

Parameter

Parameter Type Required

Description 

group_name string No Re-sort broadcast into another group
broadcast_name string No Update broadcast name
email_subject string No Update email subject of the broadcast
content_html string No Update HTML content for the broadcast
content_text string No Update Text version of the broadcast
response 0, 1 (default: 0) No Get full response of the operation


Response Parameters

Parameter Type

Description 

status JSON Success or Error
result JSON Result of the operation
response JSON Output of the operation


Example Request (CURL)

<?php
// Authentication
$api_token	=	'API_KEY'; // Mumara API Key (can be found in Settings -> API Key)
$domain		=	'http://www.anydomain.com'; // Your Mumara Domain Name


// API Endpoint
$endpoint	=	'/api/updateBroadcast/';

//Broadcast id
$broadcast_id	=	 '23';

//parameters
$params = [
    'broadcast_name' => 'Test Broadcast',
    'group_name'     => 'Test Group',
    'email_subject'  => 'Big Discount Offer',
    'content_html'   => '<p>Rush to the stores and get 50% discount on your next purchase.</p>',
    'content_text'   => 'Rush to the stores and get 50% discount on your next purchase',
    'response'       => 1,
];

// Defining cURL Request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$domain.$endpoint.$broadcast_id);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER,
    array('Content-Type: application/json', 'Authorization: Bearer ' . $api_token));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Executing cURL
$output = curl_exec($ch);

// Printing Output
echo "<pre>";
echo json_encode(json_decode($output),JSON_PRETTY_PRINT );

// Closing cURL
curl_close ($ch);

?>


Example Response (CURL)

 {
    "status": "success",
    "result": "Success: Broadcast successfully updated.",
    "response": {
        "id": 6,
        "name": "Test Broadcast",
        "subject": "Big Discount Offer",
        "group_id": 9,
        "content_html": "<p>Rush to the stores and get 50% discount on your next purchase.<\/p>",
        "content_text": "Rush to the stores and get 50% discount on your next purchase",
        "user_id": 2,
        "created_at": "2019-05-14 10:56:52",
        "updated_at": "2019-05-14 11:27:41"
    }
 }

Status value of the success response will be "Success"


Example Error Response (JSON)

 {
    "status": "error",
    "result": "Error: Broadcast doesn't exist."
 }


Possible Errors

  • Invalid broadcast id
  • Invalid group name
  • Access Denied
PUT
/api/updateBroadcast/{id}
Try it out