From 69ba22fc9b26cce39251106bf784472995a07a2e Mon Sep 17 00:00:00 2001 From: Rupenieks Date: Fri, 22 May 2020 10:22:00 +0200 Subject: [PATCH 1/2] Credentials Subdomain --- packages/nodes-base/credentials/AgileCrmApi.credentials.ts | 6 ++++++ packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/credentials/AgileCrmApi.credentials.ts b/packages/nodes-base/credentials/AgileCrmApi.credentials.ts index d189270932..2e25893c9a 100644 --- a/packages/nodes-base/credentials/AgileCrmApi.credentials.ts +++ b/packages/nodes-base/credentials/AgileCrmApi.credentials.ts @@ -19,5 +19,11 @@ export class AgileCrmApi implements ICredentialType { type: 'string' as NodePropertyTypes, default: '', }, + { + displayName: 'Subdomain', + name: 'subdomain', + type: 'string' as NodePropertyTypes, + default: '', + }, ]; } diff --git a/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts b/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts index 8be59de7f5..59a16d6811 100644 --- a/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts +++ b/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts @@ -45,8 +45,9 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction } export async function agileCrmApiRequestUpdate(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method = 'PUT', endpoint?: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise { // tslint:disable-line:no-any - const baseUri = 'https://n8nio.agilecrm.com/dev/'; + const credentials = this.getCredentials('agileCrmApi'); + const baseUri = `https://${credentials!.subdomain}.agilecrm.com/dev/`; const options: OptionsWithUri = { method, headers: { From c0dfaed4d0a10edb40137df529deade960b6f682 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Fri, 22 May 2020 21:17:27 +0200 Subject: [PATCH 2/2] :zap: Fix some minor issue in AgileCRM --- packages/nodes-base/credentials/AgileCrmApi.credentials.ts | 6 ++++-- packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/credentials/AgileCrmApi.credentials.ts b/packages/nodes-base/credentials/AgileCrmApi.credentials.ts index 2e25893c9a..65dbc7dd5e 100644 --- a/packages/nodes-base/credentials/AgileCrmApi.credentials.ts +++ b/packages/nodes-base/credentials/AgileCrmApi.credentials.ts @@ -12,8 +12,8 @@ export class AgileCrmApi implements ICredentialType { name: 'email', type: 'string' as NodePropertyTypes, default: '', - }, - { + }, + { displayName: 'API Key', name: 'apiKey', type: 'string' as NodePropertyTypes, @@ -24,6 +24,8 @@ export class AgileCrmApi implements ICredentialType { name: 'subdomain', type: 'string' as NodePropertyTypes, default: '', + placeholder: 'example', + description: 'If the domain is https://example.agilecrm.com "example" would have to be entered.', }, ]; } diff --git a/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts b/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts index 59a16d6811..71d5a68c14 100644 --- a/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts +++ b/packages/nodes-base/nodes/AgileCrm/GenericFunctions.ts @@ -27,7 +27,7 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction username: credentials!.email as string, password: credentials!.apiKey as string }, - uri: uri || `https://n8nio.agilecrm.com/dev/${endpoint}`, + uri: uri || `https://${credentials!.subdomain}.agilecrm.com/dev/${endpoint}`, json: true, }; @@ -45,7 +45,7 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction } export async function agileCrmApiRequestUpdate(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method = 'PUT', endpoint?: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise { // tslint:disable-line:no-any - + const credentials = this.getCredentials('agileCrmApi'); const baseUri = `https://${credentials!.subdomain}.agilecrm.com/dev/`; const options: OptionsWithUri = {