n8n-nodes-base
Version:
Base nodes of n8n
205 lines (199 loc) • 6.98 kB
text/typescript
/**
* HTTP Request Node - Version 2
* Makes an HTTP request and returns the response data
*/
export interface HttpRequestV2Params {
authentication?: 'none' | 'predefinedCredentialType' | 'genericCredentialType';
/**
* Credential Type
* @displayOptions.show { authentication: ["predefinedCredentialType"] }
*/
nodeCredentialType?: string;
/**
* Generic Auth Type
* @displayOptions.show { authentication: ["genericCredentialType"] }
*/
genericAuthType?: 'httpBasicAuth' | 'httpBearerAuth' | 'httpDigestAuth' | 'httpHeaderAuth' | 'httpQueryAuth' | 'httpCustomAuth' | 'oAuth1Api' | 'oAuth2Api' | Expression<string>;
/**
* The request method to use
* @default GET
*/
requestMethod?: 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | Expression<string>;
/**
* The URL to make the request to
*/
url?: string | Expression<string> | PlaceholderValue;
/**
* Whether to download the response even if SSL certificate validation is not possible
* @default false
*/
allowUnauthorizedCerts?: boolean | Expression<boolean>;
/**
* The format in which the data gets returned from the URL
* @default json
*/
responseFormat?: 'file' | 'json' | 'string' | Expression<string>;
/**
* Name of the property to which to write the response data
* @displayOptions.show { responseFormat: ["string"] }
* @default data
*/
dataPropertyName?: string | Expression<string> | PlaceholderValue;
/**
* Whether the query and/or body parameter should be set via the value-key pair UI or JSON/RAW
* @default false
*/
jsonParameters?: boolean | Expression<boolean>;
options?: {
/** Time (in milliseconds) between each batch of requests. 0 for disabled.
* @default 1000
*/
batchInterval?: number | Expression<number>;
/** Input will be split in batches to throttle requests. -1 for disabled. 0 will be treated as 1.
* @default 50
*/
batchSize?: number | Expression<number>;
/** Content-Type to use to send body parameters
* @displayOptions.show { /requestMethod: ["PATCH", "POST", "PUT"] }
* @default json
*/
bodyContentType?: 'json' | 'raw' | 'multipart-form-data' | 'form-urlencoded' | Expression<string>;
/** Whether to return the full response data instead of only the body
* @default false
*/
fullResponse?: boolean | Expression<boolean>;
/** Whether to follow All HTTP 3xx redirects
* @default false
*/
followAllRedirects?: boolean | Expression<boolean>;
/** Whether to follow GET or HEAD HTTP 3xx redirects
* @default true
*/
followRedirect?: boolean | Expression<boolean>;
/** Whether to succeeds also when status code is not 2xx
* @default false
*/
ignoreResponseCode?: boolean | Expression<boolean>;
/** Specify the mime type for raw/custom body type
* @displayOptions.show { /requestMethod: ["PATCH", "POST", "PUT"] }
*/
bodyContentCustomMimeType?: string | Expression<string> | PlaceholderValue;
/** HTTP proxy to use
*/
proxy?: string | Expression<string> | PlaceholderValue;
/** Whether to output each element of an array as own item
* @displayOptions.show { /responseFormat: ["json"] }
* @default false
*/
splitIntoItems?: boolean | Expression<boolean>;
/** Time in ms to wait for the server to send response headers (and start the response body) before aborting the request
* @default 10000
*/
timeout?: number | Expression<number>;
/** Whether you need arrays to be serialized as foo=bar&foo=baz instead of the default foo[0]=bar&foo[1]=baz
* @default false
*/
useQueryString?: boolean | Expression<boolean>;
};
/**
* Whether binary data should be send as body
* @displayOptions.show { jsonParameters: [true], requestMethod: ["PATCH", "POST", "PUT"] }
* @default false
*/
sendBinaryData?: boolean | Expression<boolean>;
/**
* For Form-Data Multipart, they can be provided in the format: <code>"sendKey1:binaryProperty1,sendKey2:binaryProperty2</code>
* @hint The name of the input binary field containing the file to be uploaded
* @displayOptions.show { jsonParameters: [true], requestMethod: ["PATCH", "POST", "PUT"] }
* @displayOptions.hide { sendBinaryData: [false] }
* @default data
*/
binaryPropertyName?: string | Expression<string> | PlaceholderValue;
/**
* Body parameters as JSON or RAW
* @displayOptions.show { jsonParameters: [true], requestMethod: ["PATCH", "POST", "PUT", "DELETE"] }
* @displayOptions.hide { sendBinaryData: [true] }
*/
bodyParametersJson?: IDataObject | string | Expression<string>;
/**
* The body parameter to send
* @displayOptions.show { jsonParameters: [false], requestMethod: ["PATCH", "POST", "PUT", "DELETE"] }
* @default {}
*/
bodyParametersUi?: {
/** Parameter
*/
parameter?: Array<{
/** Name of the parameter
*/
name?: string | Expression<string> | PlaceholderValue;
/** Value of the parameter
*/
value?: string | Expression<string> | PlaceholderValue;
}>;
};
/**
* Header parameters as JSON or RAW
* @displayOptions.show { jsonParameters: [true] }
*/
headerParametersJson?: IDataObject | string | Expression<string>;
/**
* The headers to send
* @displayOptions.show { jsonParameters: [false] }
* @default {}
*/
headerParametersUi?: {
/** Header
*/
parameter?: Array<{
/** Name of the header
*/
name?: string | Expression<string> | PlaceholderValue;
/** Value to set for the header
*/
value?: string | Expression<string> | PlaceholderValue;
}>;
};
/**
* Query parameters as JSON (flat object)
* @displayOptions.show { jsonParameters: [true] }
*/
queryParametersJson?: IDataObject | string | Expression<string>;
/**
* The query parameter to send
* @displayOptions.show { jsonParameters: [false] }
* @default {}
*/
queryParametersUi?: {
/** Parameter
*/
parameter?: Array<{
/** Name of the parameter
*/
name?: string | Expression<string> | PlaceholderValue;
/** Value of the parameter
*/
value?: string | Expression<string> | PlaceholderValue;
}>;
};
}
export interface HttpRequestV2Credentials {
httpBasicAuth: CredentialReference;
httpDigestAuth: CredentialReference;
httpHeaderAuth: CredentialReference;
httpQueryAuth: CredentialReference;
oAuth1Api: CredentialReference;
oAuth2Api: CredentialReference;
/** Generic auth credentials - set the 'genericAuthType' config parameter to select which one to use */
httpBearerAuth?: CredentialReference;
httpCustomAuth?: CredentialReference;
}
interface HttpRequestV2NodeBase {
type: 'n8n-nodes-base.httpRequest';
version: 2;
credentials?: HttpRequestV2Credentials;
}
export type HttpRequestV2ParamsNode = HttpRequestV2NodeBase & {
config: NodeConfig<HttpRequestV2Params>;
};
export type HttpRequestV2Node = HttpRequestV2ParamsNode;