Uninstalling your Application through the API

There are situations where an application wants to remove old installations from the system. In cases where user intervention is not required, you can send a request to haravan API to cause an Application to be removed from a Shop.

Uninstalling an application is an irreversible operation. Be entirely sure that you no longer need to make API calls for the shop in which the application has been installed.

Uninstalling an application also performs various cleanup tasks within haravan. Registered Webhooks, ScriptTags and App Links will be destroyed as part of this operation. Also if an application is uninstalled during key rotation, both the old and new Access Tokens will be rendered useless.

Example Implementations

Ruby

The following shows a basic example implementation of API Access revocation

require 'rest_client'
require 'json'

access_token = 'secret'
revoke_url   = 'https://someshop.myharavan.com/admin/oauth/revoke'

headers = {
  'X-haravan-Access-Token' => access_token,
  content_type: 'application/json',
  accept: 'application/json'
}

response = RestClient.delete(revoke_url, headers)
decoded = JSON.parse(response.body)['permission']
decoded['access_token'] # 'secret'

PHP

The following shows a basic example implementation of API Access revocation

<?php
  $access_token = "secret";
  $revoke_url   = "https://someshop.myharavan.com/admin/oauth/revoke"

  $headers = array(
    "Content-Type: application/json",
    "Accept: application/json",
    "Content-Length: 0",
    "X-haravan-Access-Token: " . $access_token
  );

  $handler = curl_init($revoke_url);
  curl_setopt($handler, CURLOPT_CUSTOMREQUEST, "DELETE");
  curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($handler, CURLOPT_HTTPHEADER, $headers);

  $response = curl_exec($handler);
?>

<?php echo($response); ?>
<!-- {"access_token": "secret"} -->

Haravan - Công ty công nghệ cung cấp giải pháp kinh doanh thương mại điện tử, duy nhất tại Việt Nam được Google lựa chọn vào chương trình bệ phóng tiềm năng với hỗ trợ và đào tạo công nghệ để vươn ra thị trường quốc tế vững chắc.