Customers | Delete Customer Accsount

Customer Account Deletion Endpoint

This document provides instructions on using the set_customer_delete_account endpoint for deleting a customer's account from the API server's database. This endpoint is particularly important for applications, including mobile apps, to comply with EU policies, where customers have the right to delete their profile data.

API Endpoint for Account Deletion

This API call is essential for enabling customers to exercise their right to have their account and associated data deleted from the system.

Account Deletion Process

To delete a customer's account, use the set_customer_delete_account API call. This process involves the customer providing their email and password for verification before the account deletion is executed.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/set_customer_delete_account/
  • Method: POST

Mandatory Parameters | Payload

For a successful account deletion, the following parameters are mandatory:

  • email: The email address of the customer whose account is to be deleted.
  • customer_password: The current password of the customer's account.

Process Description

The account deletion process includes the following steps:

  1. Customer Verification: The system verifies the customer's identity using the provided email and password.
  2. Deletion Initiation: Upon successful verification, the request to delete the customer's account is processed.
  3. Confirmation: Once the account is deleted, a confirmation is typically sent to the customer's email address for their records.

Compliance Note

  • This API call is vital for applications, particularly in the EU region, where customers have the right under certain policies to request the deletion of their personal data.
  • The set_customer_delete_account endpoint ensures that applications are compliant with such regulations by providing customers with a straightforward method to delete their accounts.

Notes

  • It is crucial for the email and customer_password to match the existing account details for the deletion process to proceed.
  • Customers should be aware that once their account is deleted, it cannot be recovered and all associated data will be permanently removed.



Call Examples in Different Languages


curl -X POST 'https://easycms.fi/public_api/set_customer_delete_account' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com&customer_password=YOUR_CUSTOMER_PASSWORD'

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://easycms.fi/public_api/set_customer_delete_account",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => http_build_query(['username' => 'USERNAME', 'password' => 'PASSWORD', 'account' => 'ACCOUNT_ID', 'email' => 'customer@mail.com', 'customer_password' => 'YOUR_CUSTOMER_PASSWORD']),
  CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

import requests
url = "https://easycms.fi/public_api/set_customer_delete_account"
headers = {"Authorization1": "TOKEN"}
payload = {'username': 'USERNAME', 'password': 'PASSWORD', 'account': 'ACCOUNT_ID', 'email': 'customer@mail.com', 'customer_password': 'YOUR_CUSTOMER_PASSWORD'}
response = requests.post(url, headers=headers, data=payload)
print(response.text)

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://easycms.fi/public_api/set_customer_delete_account"))
    .headers("Authorization1", "TOKEN")
    .POST(HttpRequest.BodyPublishers.ofString("username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&email=customer@mail.com&customer_password=YOUR_CUSTOMER_PASSWORD"))
    .build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

const https = require('https');
const data = new URLSearchParams({ 
  username: 'USERNAME', 
  password: 'PASSWORD', 
  account: 'ACCOUNT_ID',
  email: 'customer@mail.com',
  customer_password: 'YOUR_CUSTOMER_PASSWORD'
}).toString();
const options = {
  hostname: 'prolasku.fi',
  path: '/public_api/set_customer_delete_account',
  method: 'POST',
  headers: {
    'Authorization1': 'TOKEN',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': data.length
  }
};
const req = https.request(options, (res) => {
  let data = '';
  res.on('data', (chunk) => { data += chunk; });
  res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();

import React, { useEffect, useState } from 'react';
function App() {
  const [responseText, setResponseText] = useState('');
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch('https://easycms.fi/public_api/set_customer_delete_account', {
          method: 'POST',
          headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
          body: new URLSearchParams({username: 'USERNAME', password: 'PASSWORD', account: 'ACCOUNT_ID', email: 'customer@mail.com', customer_password: 'YOUR_CUSTOMER_PASSWORD'}).toString()
        });
        const data = await response.text();
        setResponseText(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (
{responseText}
); } export default App;

// Kotlin example requires using a third-party library like OkHttp for POST requests with a body
// Kotlin Example using OkHttp for POST request
import okhttp3.OkHttpClient
import okhttp3.FormBody
import okhttp3.Request

fun main() {
    val client = OkHttpClient()

    val formBody = FormBody.Builder()
        .add("username", "USERNAME")
        .add("password", "PASSWORD")
        .add("account", "ACCOUNT_ID")
        .add("email", "customer@mail.com")
        .add("customer_password", "YOUR_CUSTOMER_PASSWORD")
        .build()

    val request = Request.Builder()
        .url("https://easycms.fi/public_api/set_customer_delete_account")
        .post(formBody)
        .addHeader("Authorization1", "TOKEN")
        .build()

    client.newCall(request).execute().use { response ->
        if (!response.isSuccessful) throw IOException("Unexpected code $response")

        println(response.body?.string())
    }
}

using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        var token = "TOKEN";
        var content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair("username", "USERNAME"),
            new KeyValuePair("password", "PASSWORD"),
            new KeyValuePair("account", "ACCOUNT_ID"),
            new KeyValuePair("email", "customer@mail.com"),
            new KeyValuePair("customer_password", "YOUR_CUSTOMER_PASSWORD")
        });
        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Add("Authorization1", token);
            var response = await httpClient.PostAsync("https://easycms.fi/public_api/set_customer_delete_account", content);
            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}




Handling Endpoint Results

When you make a request to the endpoint, you receive a JSON response containing various keys and values. Here's an explanation of the response keys and their meanings:


{
    "INFO": {
        "start": 0,
        "limit": 1,
        "count": 1,
        "total_count": 1,
        "tip": ""
    },
    "OUTPUT": {
        "response_type": "success",
        "message": "customer_acccount_deleted_successfully"
    }
}
    

Error Handling

Here are the possible error messages and their meanings:

  • UN-AUTHORIZED - _user_name_password_is_set_but_wrong_value!: Incorrect username or password.
  • email_is_not_valid: Incorrect email format or email does not exist or email server not responding based on API server's email verification module.
  • this_account_does_not_exist_or_your_credentials_do_not_match_this_account: The account doesn't exist or mismatched credentials.
  • UN-AUTHORIZED - header is set but the header value is not correct!: Incorrect authorization header value.
  • Maximum query size is 1 rows per query: Exceeded maximum limit of 1 rows per query.