-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new credentials for the HTTP Request node (#9833)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com> Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
- Loading branch information
1 parent
6422fb3
commit 26f1af3
Showing
16 changed files
with
827 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import type { | ||
ICredentialDataDecryptedObject, | ||
ICredentialTestRequest, | ||
ICredentialType, | ||
IHttpRequestOptions, | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export class DatadogApi implements ICredentialType { | ||
name = 'datadogApi'; | ||
|
||
displayName = 'Datadog API'; | ||
|
||
documentationUrl = 'datadog'; | ||
|
||
icon = { light: 'file:icons/Datadog.svg', dark: 'file:icons/Datadog.svg' } as const; | ||
|
||
httpRequestNode = { | ||
name: 'Datadog', | ||
docsUrl: 'https://docs.datadoghq.com/api/latest/', | ||
apiBaseUrlPlaceholder: 'https://api.datadoghq.com/api/v1/metrics', | ||
}; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'URL', | ||
name: 'url', | ||
required: true, | ||
type: 'string', | ||
default: 'https://api.datadoghq.com', | ||
}, | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
required: true, | ||
type: 'string', | ||
typeOptions: { password: true }, | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'APP Key', | ||
name: 'appKey', | ||
required: false, | ||
type: 'string', | ||
default: '', | ||
typeOptions: { password: true }, | ||
description: 'For some endpoints, you also need an Application key.', | ||
}, | ||
]; | ||
|
||
async authenticate( | ||
credentials: ICredentialDataDecryptedObject, | ||
requestOptions: IHttpRequestOptions, | ||
): Promise<IHttpRequestOptions> { | ||
requestOptions.headers = { | ||
'DD-API-KEY': credentials.apiKey, | ||
'DD-APPLICATION-KEY': credentials.appKey, | ||
}; | ||
if (!requestOptions.headers['DD-APPLICATION-KEY']) { | ||
delete requestOptions.headers['DD-APPLICATION-KEY']; | ||
} | ||
|
||
return requestOptions; | ||
} | ||
|
||
test: ICredentialTestRequest = { | ||
request: { | ||
baseURL: '={{$credentials.url}}', | ||
url: '/api/v1/validate', | ||
method: 'GET', | ||
}, | ||
}; | ||
} |
67 changes: 67 additions & 0 deletions
67
packages/nodes-base/credentials/DfirIrisApi.credentials.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { | ||
IAuthenticateGeneric, | ||
ICredentialTestRequest, | ||
ICredentialType, | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export class DfirIrisApi implements ICredentialType { | ||
name = 'dfirIrisApi'; | ||
|
||
displayName = 'DFIR-IRIS API'; | ||
|
||
documentationUrl = 'dfiriris'; | ||
|
||
icon = { light: 'file:icons/DfirIris.svg', dark: 'file:icons/DfirIris.svg' } as const; | ||
|
||
httpRequestNode = { | ||
name: 'DFIR-IRIS', | ||
docsUrl: 'https://docs.dfir-iris.org/operations/api/', | ||
apiBaseUrlPlaceholder: 'http://<yourserver_ip>/manage/cases/list', | ||
}; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'Base URL', | ||
name: 'baseUrl', | ||
type: 'string', | ||
default: '', | ||
placeholder: 'e.g. https://localhost', | ||
description: | ||
'The API endpoints are reachable on the same Address and port as the web interface.', | ||
required: true, | ||
}, | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
required: true, | ||
type: 'string', | ||
typeOptions: { password: true }, | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Ignore SSL Issues', | ||
name: 'skipSslCertificateValidation', | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
]; | ||
|
||
authenticate: IAuthenticateGeneric = { | ||
type: 'generic', | ||
properties: { | ||
headers: { | ||
Authorization: '=Bearer {{$credentials.apiKey}}', | ||
}, | ||
}, | ||
}; | ||
|
||
test: ICredentialTestRequest = { | ||
request: { | ||
baseURL: '={{$credentials.baseUrl}}', | ||
url: '/api/ping', | ||
method: 'GET', | ||
skipSslCertificateValidation: '={{$credentials.skipSslCertificateValidation}}', | ||
}, | ||
}; | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/nodes-base/credentials/DynatraceApi.credentials.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow'; | ||
|
||
export class DynatraceApi implements ICredentialType { | ||
name = 'dynatraceApi'; | ||
|
||
displayName = 'DynatraceAPI'; | ||
|
||
documentationUrl = 'dynatrace'; | ||
|
||
icon = { light: 'file:icons/Dynatrace.svg', dark: 'file:icons/Dynatrace.svg' } as const; | ||
|
||
httpRequestNode = { | ||
name: 'Dynatrace', | ||
docsUrl: 'https://docs.dynatrace.com/docs/dynatrace-api', | ||
apiBaseUrlPlaceholder: 'https://{your-environment-id}.live.dynatrace.com/api/v2/events', | ||
}; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
required: true, | ||
type: 'string', | ||
typeOptions: { password: true }, | ||
default: '', | ||
}, | ||
]; | ||
|
||
authenticate: IAuthenticateGeneric = { | ||
type: 'generic', | ||
properties: { | ||
headers: { | ||
Authorization: '=Api-Token {{$credentials.apiKey}}', | ||
}, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/nodes-base/credentials/FilescanApi.credentials.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { | ||
IAuthenticateGeneric, | ||
ICredentialTestRequest, | ||
ICredentialType, | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export class FilescanApi implements ICredentialType { | ||
name = 'filescanApi'; | ||
|
||
displayName = 'Filescan API'; | ||
|
||
documentationUrl = 'filescan'; | ||
|
||
icon = { light: 'file:icons/Filescan.svg', dark: 'file:icons/Filescan.svg' } as const; | ||
|
||
httpRequestNode = { | ||
name: 'Filescan', | ||
docsUrl: 'https://www.filescan.io/api/docs', | ||
apiBaseUrlPlaceholder: 'https://www.filescan.io/api/system/do-healthcheck', | ||
}; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
required: true, | ||
type: 'string', | ||
typeOptions: { password: true }, | ||
default: '', | ||
}, | ||
]; | ||
|
||
authenticate: IAuthenticateGeneric = { | ||
type: 'generic', | ||
properties: { | ||
headers: { | ||
'X-Api-Key': '={{$credentials.apiKey}}', | ||
}, | ||
}, | ||
}; | ||
|
||
test: ICredentialTestRequest = { | ||
request: { | ||
baseURL: 'https://www.filescan.io/api', | ||
url: '/system/do-healthcheck', | ||
method: 'GET', | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { | ||
IAuthenticateGeneric, | ||
ICredentialTestRequest, | ||
ICredentialType, | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export class MalcoreApi implements ICredentialType { | ||
name = 'malcoreApi'; | ||
|
||
displayName = 'MalcoreAPI'; | ||
|
||
documentationUrl = 'malcore'; | ||
|
||
icon = { light: 'file:icons/Malcore.png', dark: 'file:icons/Malcore.png' } as const; | ||
|
||
httpRequestNode = { | ||
name: 'Malcore', | ||
docsUrl: 'https://malcore.readme.io/reference/upload', | ||
apiBaseUrlPlaceholder: 'https://api.malcore.io/api/urlcheck', | ||
}; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
required: true, | ||
type: 'string', | ||
typeOptions: { password: true }, | ||
default: '', | ||
}, | ||
]; | ||
|
||
authenticate: IAuthenticateGeneric = { | ||
type: 'generic', | ||
properties: { | ||
headers: { | ||
apiKey: '={{$credentials.apiKey}}', | ||
}, | ||
}, | ||
}; | ||
|
||
test: ICredentialTestRequest = { | ||
request: { | ||
baseURL: 'https://api.malcore.io/api', | ||
url: '/urlcheck', | ||
method: 'POST', | ||
body: { url: 'google.com' }, | ||
}, | ||
}; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.