mirror of
https://github.com/n8n-io/n8n-docs.git
synced 2025-11-20 17:48:34 +00:00
quick polish of http node
This commit is contained in:
parent
d12a823eb7
commit
1191704c20
@ -12,11 +12,14 @@ When using this node, you're creating a REST API call. You need some understandi
|
||||
|
||||
There are two ways to create an HTTP request: configure the [node fields](#node-fields) or [import a curl command](#import-curl-command).
|
||||
|
||||
## Node fields
|
||||
!!! note "Examples and templates"
|
||||
For usage examples and templates to help you get started, refer to n8n's [HTTP Request integrations](https://n8n.io/integrations/http-request/){:target=_blank .external-link} page.
|
||||
|
||||
## Node parameters
|
||||
|
||||
### Method
|
||||
|
||||
Select the method to be used for the request:
|
||||
Select the method to use for the request:
|
||||
|
||||
- DELETE
|
||||
- GET
|
||||
@ -32,7 +35,7 @@ Enter the endpoint you want to use.
|
||||
|
||||
### Authentication
|
||||
|
||||
There are two options for authentication. n8n recommends using the **Predefined credential type** option when it's available. It offers an easier way to set up and manage credentials, compared to configuring generic credentials.
|
||||
n8n recommends using the **Predefined Credential Type** option when it's available. It offers an easier way to set up and manage credentials, compared to configuring generic credentials.
|
||||
|
||||
#### Predefined credentials
|
||||
|
||||
@ -42,12 +45,14 @@ Select **Predefined Credential Type**. This allows you to perform custom operati
|
||||
|
||||
Select **Generic Credential Type** to set up authentication using one of the following methods:
|
||||
|
||||
- Basic Auth
|
||||
- Digest Auth
|
||||
- Header Auth
|
||||
- OAuth1
|
||||
- OAuth2
|
||||
- None
|
||||
* Basic Auth
|
||||
* Custom Auth
|
||||
* Digest Auth
|
||||
* Header Auth
|
||||
* OAuth1 API
|
||||
* OAuth2 API
|
||||
* Query Auth
|
||||
|
||||
|
||||
Refer to [HTTP request credentials](/integrations/builtin/credentials/httprequest/) for more information setting up each credential type.
|
||||
|
||||
@ -84,65 +89,4 @@ Import a curl command:
|
||||
3. Select **Import**. n8n loads the request configuration into the node fields. This overwrites any existing configuration.
|
||||
|
||||
|
||||
## Basic example
|
||||
|
||||
This example uses [Reqres](https://reqres.in/){:target=_blank .external-link}, a service for testing APIs with fake data. It provides a basic usage example.
|
||||
|
||||
### Setup
|
||||
|
||||
Create a new workflow and add the HTTP Request node.
|
||||
|
||||
Enter `https://reqres.in/api/users` in the **URL** field. All the examples call this endpoint.
|
||||
|
||||
### Get a list of users
|
||||
|
||||
Ensure the **Method** is set to **GET**.
|
||||
|
||||
Select **Execute node**. n8n calls the `users` endpoint of the Reqres API, and outputs the response.
|
||||
|
||||
### Add a user
|
||||
|
||||
1. Select **POST** in the **Method** dropdown list.
|
||||
2. Enable **Send Body**.
|
||||
3. Enter `name` in the **Name** field.
|
||||
4. Enter `Neo` in the **Value** field.
|
||||
5. Select **Add Parameter**
|
||||
6. Enter `job` in the **Name** field.
|
||||
7. Enter `Programmer` in the **Value** field.
|
||||
8. Select **Execute node** to run the workflow. n8n calls the `users` endpoint of the Reqres API, and outputs the response.
|
||||
|
||||
## More examples
|
||||
|
||||
### Fetch a binary file from a URL
|
||||
|
||||
1. Enter the URL of the file in the **URL** field. For example, you can enter `https://docs.n8n.io/_images/n8n-docs-icon.svg` to fetch the n8n logo.
|
||||
2. Select **Add Option > Response**.
|
||||
3. Set **Response Format** to **File**.
|
||||
4. Select **Execute node** to run the node.
|
||||
|
||||
### Send a binary file to an API endpoint
|
||||
|
||||
1. Connect the HTTP Request node with a node that has previously fetched the binary file. For example, this could be an HTTP Request node, [Read Binary File](/integrations/builtin/core-nodes/n8n-nodes-base.readbinaryfile/) node, [Google Drive](/integrations/builtin/app-nodes/n8n-nodes-base.googledrive/) node, and so on.
|
||||
2. Select **POST** in the **Method** dropdown. Check the API documentation of your API to make sure that you have selected the correct HTTP request method.
|
||||
3. Enter the URL you want to send the binary file to in the **URL** field.
|
||||
4. Enable **Send Body**.
|
||||
5. In **Body Content Type**, select **n8n Binary Data**.
|
||||
6. In **Input Data Field Name**, enter the name of the field containing the binary data.
|
||||
9. Select **Execute node** to run the node.
|
||||
|
||||
Refer to this [workflow template](https://n8n.io/workflows/1338-update-twitter-banner-using-http-request/){:target=_blank .external link} for a full example.
|
||||
|
||||
### Get the HTTP status code after an execution
|
||||
|
||||
1. Select **Add Option** > **Response**.
|
||||
2. Enable **Include Response Headers and Status**.
|
||||
|
||||
When you execute the node, n8n includes the headers, status code, and status message in the output.
|
||||
|
||||
### Send XML data
|
||||
|
||||
1. Enable **Send Body**.
|
||||
2. In **Body Content Type**, select **Raw**.
|
||||
3. In **Content Type**, enter `application/xml`.
|
||||
4. Enter the XML data in the **Body** field.
|
||||
|
||||
|
||||
@ -25,11 +25,12 @@ You can use [Predefined credential types](/integrations/custom-operations/#prede
|
||||
The following generic authentication methods are available:
|
||||
|
||||
* Basic Auth
|
||||
* Custom Auth
|
||||
* Digest Auth
|
||||
* Header Auth
|
||||
* OAuth1
|
||||
* OAuth2
|
||||
* None
|
||||
* OAuth1 API
|
||||
* OAuth2 API
|
||||
* Query Auth
|
||||
|
||||
You can learn more about HTTP authentication [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#see_also){:target=_blank .external-link}.
|
||||
|
||||
|
||||
@ -36,12 +36,6 @@ _Briefly summarize the functionality._
|
||||
## Node parameters
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
Add any other sections here.
|
||||
You should include: quirks, pain points, complex topics that trip people up
|
||||
|
||||
Loading…
Reference in New Issue
Block a user