mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
🐛 Select base url depending on the datacenter (#1744)
This commit is contained in:
@@ -53,7 +53,7 @@ export class ZohoOAuth2Api implements ICredentialType {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'CN - https://accounts.zoho.com.cn/oauth/v2/token',
|
name: 'CN - https://accounts.zoho.com.cn/oauth/v2/token',
|
||||||
value: ' https://accounts.zoho.com.cn/oauth/v2/token',
|
value: 'https://accounts.zoho.com.cn/oauth/v2/token',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'https://accounts.zoho.com/oauth/v2/token',
|
default: 'https://accounts.zoho.com/oauth/v2/token',
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { OptionsWithUri } from 'request';
|
import {
|
||||||
|
OptionsWithUri,
|
||||||
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
IExecuteSingleFunctions,
|
IExecuteSingleFunctions,
|
||||||
@@ -9,6 +12,8 @@ import {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function zohoApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function zohoApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
const { oauthTokenData: { api_domain } } = this.getCredentials('zohoOAuth2Api') as { [key: string]: IDataObject };
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -20,7 +25,7 @@ export async function zohoApiRequest(this: IExecuteFunctions | IExecuteSingleFun
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
qs,
|
qs,
|
||||||
uri: uri || `https://www.zohoapis.com/crm/v2${resource}`,
|
uri: uri || `${api_domain}/crm/v2${resource}`,
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
@@ -31,7 +36,7 @@ export async function zohoApiRequest(this: IExecuteFunctions | IExecuteSingleFun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function zohoApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
export async function zohoApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
@@ -51,4 +56,4 @@ export async function zohoApiRequestAllItems(this: IExecuteFunctions | ILoadOpti
|
|||||||
);
|
);
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user