Wiki

Clone wiki

phpsdkswikly / Delete a swik

Delete a swik

Before reading this make sure you understood the Initialization process. It will be required for the Step 3.

1 - Create a swik object

<?php
$swik = new \Swikly\Swik();

2 - Set the swik's informations

The Id is your Id that you provide when you created the swik.

<?php
$swik->setSwikId("YOUR_ID");

3 - Canceling / Deleting a swik

The deleteSwik function make a call on the swikly api. If Id is correct the swik is deleted.

<?php
$result = $swkAPI->deleteSwik($swik);

4 - Handling the result

  • If no error happened, a status 'ok' is returned and the swik is correctly deleted.
  • If there is an error with the Id that you set or with the Swikly API itself you can hande it as you prefer.
<?php
if ($result['status'] == 'ok') {
    echo "Swik deleted correctly";
} else {
    echo "Failed delete swik";
    echo "Error = " . $result['message'];
}

5 - Full code

<?php
// 1. Load the SDK file.
require 'YOUR/PATH/phpSdkSwikly.php';

$swkAPI = new \Swikly\SwiklyAPI('example_api_key', 'API_SECRET');

// Create a swik object
$swik = new \Swikly\Swik();

// Set the Id you used to create it
$swik->setSwikId("YOUR_ID");

// Deleting the swik
$result = $swkAPI->deleteSwik($swik);

// Print result of the operation
if ($result['status'] == 'ok') {
    echo "Swik deleted correctly";
} else {
    echo "Failed delete swik";
    echo "Error = " . $result['message'];
}
<< Previous Page || Back to menu || Next Page >>

Updated