mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Contact Delete
This commit is contained in:
parent
dce70ad5c7
commit
e17df72dc6
|
@ -80,6 +80,14 @@ export class AgileCrm implements INodeType {
|
|||
|
||||
}
|
||||
|
||||
if(operation === 'delete'){
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
|
||||
const endpoint = `api/contacts/${contactId}`;
|
||||
responseData = await agileCrmApiRequest.call(this, 'DELETE', endpoint, {});
|
||||
|
||||
}
|
||||
|
||||
if(operation === 'getAll'){
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
|
|
|
@ -30,6 +30,16 @@ export const contactOperations = [
|
|||
value: 'create',
|
||||
description: 'Create a new contact',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update contact properties',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a contact',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
description: 'The operation to perform.',
|
||||
|
@ -555,9 +565,28 @@ export const contactFields = [
|
|||
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* contact:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Unique identifier for a particular contact',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -30,8 +30,8 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction
|
|||
json: true
|
||||
};
|
||||
|
||||
// Only add Body property if method not GET to avoid 400 response
|
||||
if(method !== "GET"){
|
||||
// Only add Body property if method not GET or DELETE to avoid 400 response
|
||||
if(method !== "GET" && method !== "DELETE"){
|
||||
options.body = body;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue