Delete file attachment from task task.item.deletefile

Scope: task

Who can execute the method: any user

This method removes the file attachment from a task.

Method parameters

Name

Description

auth

Authorization token

TASK_ID

Task identifier

ATTACHMENT_ID

Identifier of the attached file

Code examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"TASK_ID":3,"ATTACHMENT_ID":28}' \
        https://your-domain.com/rest/**put_your_user_id_here**/**put_your_webhook_here**/task.item.deletefile
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"TASK_ID":3,"ATTACHMENT_ID":28,"auth":"1iqeuq94vzfxu01bouws3voja2lsezfq"}' \
        https://your-domain.com/rest/task.item.deletefile
        
try
        {
        	const response = await $b24.callMethod(
        		'task.item.deletefile',
        		{
        			TASK_ID: 3,
        			ATTACHMENT_ID: 28
        		}
        	);
        	
        	const result = response.getData().result;
        	console.log(result);
        }
        catch( error )
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'task.item.deletefile',
                    [
                        'TASK_ID'       => 3,
                        'ATTACHMENT_ID' => 28
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                error_log($result->error());
            } else {
                echo 'Success: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error deleting file: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'task.item.deletefile',
            {
                TASK_ID: 3,
                ATTACHMENT_ID: 28
            },
            function(result) {
                if(result.error())
                    console.error(result.error());
                else
                    console.log(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'task.item.deletefile',
            [
                'TASK_ID' => 3,
                'ATTACHMENT_ID' => 28
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';