Check permission
Checks whether the user has a permission on a module. Agents can only hold agent-interface permissions.
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
check_permissionfor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
Permission to check, for example create, modify or delete.
ExamplemodifyModule to check, for example
campaign,listsorleads.Examplecampaign
curl https://api.dcdial.com/api/ \ -d type=check_permission \ -d token="$DCDIAL_TOKEN" \ -d perm_type=modify \ -d module=campaign<?php$ch = curl_init('https://api.dcdial.com/api/');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'type' => 'check_permission', 'token' => getenv('DCDIAL_TOKEN'), 'perm_type' => 'modify', 'module' => 'campaign', ]),]);$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (($result['response']['success'] ?? 0) != 1) { throw new RuntimeException($result['response']['error'] ?? 'Request failed');}const res = await fetch('https://api.dcdial.com/api/', { method: 'POST', body: new URLSearchParams({ type: "check_permission", token: process.env.DCDIAL_TOKEN, perm_type: "modify", module: "campaign", }),});const { response } = await res.json();if (response.success != 1) throw new Error(response.error);import osimport requests
r = requests.post( "https://api.dcdial.com/api/", data={ "type": "check_permission", "token": os.environ["DCDIAL_TOKEN"], "perm_type": "modify", "module": "campaign", }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "success": "1", "permission": "" }}Try it