🔀 Merge branch 'AgileCRM-subdomain-hotfix'

This commit is contained in:
Jan Oberhauser 2020-05-22 21:18:32 +02:00
commit 1ef89e4ab9
2 changed files with 13 additions and 4 deletions

View file

@ -12,12 +12,20 @@ export class AgileCrmApi implements ICredentialType {
name: 'email', name: 'email',
type: 'string' as NodePropertyTypes, type: 'string' as NodePropertyTypes,
default: '', default: '',
}, },
{ {
displayName: 'API Key', displayName: 'API Key',
name: 'apiKey', name: 'apiKey',
type: 'string' as NodePropertyTypes, type: 'string' as NodePropertyTypes,
default: '', default: '',
}, },
{
displayName: 'Subdomain',
name: 'subdomain',
type: 'string' as NodePropertyTypes,
default: '',
placeholder: 'example',
description: 'If the domain is https://example.agilecrm.com "example" would have to be entered.',
},
]; ];
} }

View file

@ -27,7 +27,7 @@ export async function agileCrmApiRequest(this: IHookFunctions | IExecuteFunction
username: credentials!.email as string, username: credentials!.email as string,
password: credentials!.apiKey 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, json: true,
}; };
@ -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<any> { // tslint:disable-line:no-any export async function agileCrmApiRequestUpdate(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method = 'PUT', endpoint?: string, body: any = {}, query: IDataObject = {}, uri?: string): Promise<any> { // tslint:disable-line:no-any
const baseUri = 'https://n8nio.agilecrm.com/dev/';
const credentials = this.getCredentials('agileCrmApi'); const credentials = this.getCredentials('agileCrmApi');
const baseUri = `https://${credentials!.subdomain}.agilecrm.com/dev/`;
const options: OptionsWithUri = { const options: OptionsWithUri = {
method, method,
headers: { headers: {