How to Configure HTTP Node in n8n Part 1

Difficulty
2/10
Tags
EssentialsHTTP RequestEdit Fields (Set)APIJSON

You're building a Pokemon fan site and need to pull data from the PokeAPI, transform it into a clean format, then save it to your database. This challenge teaches you the two most common HTTP methods: GET (to fetch data) and POST (to send data).

GET requests retrieve information without changing anything on the server. POST requests send data to create something new. Understanding when to use each is fundamental to working with any API.

What you'll practice:

  • Using the HTTP Request node with GET method
  • Extracting specific fields from API responses
  • Using the HTTP Request node with POST method
  • Sending JSON data in a request body

Your Task

  1. 1Copy the exercise below
  2. 2Paste into your n8n editor (Ctrl+V)
  3. 3Solve it — use hints if you get stuck
  4. 4Check the solution when done

Build a workflow that fetches Pikachu's data from the PokeAPI and saves a simplified profile to your mock database.

Step 1: Fetch Pikachu's data using GET from https://pokeapi.co/api/v2/pokemon/pikachu

Step 2: Extract the Pokemon's name, primary type, and HP stat

Step 3: Save this profile using POST to https://jsonplaceholder.typicode.com/posts with this body format:

{
  "title": "pikachu",
  "body": "Type: electric, HP: 35",
  "userId": 1
}

Expected final output (from the POST response):

{
  "title": "pikachu",
  "body": "Type: electric, HP: 35",
  "userId": 1,
  "id": 101
}

Hints

  1. Start with a Manual Trigger node to begin the workflow
  2. Add an HTTP Request node:
    • Method: GET
    • URL: https://pokeapi.co/api/v2/pokemon/pikachu
  3. The PokeAPI response has deeply nested data:
    • Name is at the top level: $json.name
    • Types are in an array: $json.types[0].type.name gets the first type
    • Stats are also in an array: find HP by accessing $json.stats[0].base_stat
  4. Add an Edit Fields node to extract and format the data you need
  5. Add another HTTP Request node:
    • Method: POST
    • URL: https://jsonplaceholder.typicode.com/posts
    • Body Content Type: JSON
    • Use the extracted values to build the request body

Tip: JSONPlaceholder is a fake API for testing. It simulates creating a record and always returns id: 101 for new posts.

Explanation

Why this solution works:

This workflow demonstrates the two most fundamental HTTP operations: reading data (GET) and creating data (POST). Almost every API integration you build will use one or both of these methods.

How it solves the problem:

  1. GET request fetches the Pokemon data. The HTTP Request node sends a GET request to PokeAPI. GET is the default method because it's the most common. The API returns detailed JSON about Pikachu including stats, types, abilities, and sprites.
  2. Edit Fields extracts what we need. The raw API response contains over 100 fields. We only need three: name, type, and HP. The expressions navigate the nested JSON structure to pull out exactly what we need.
  3. POST request saves the profile. The second HTTP Request node sends a POST request to JSONPlaceholder. We set the method to POST and provide a JSON body. The body uses data from the previous node to create a formatted profile. JSONPlaceholder echoes back our data with an id field, simulating a database save.

Key concepts:

  • GET vs POST: GET retrieves data and should never modify anything. POST sends data to create new records. This distinction matters because some APIs require specific methods.
  • JSON body: POST requests typically include a body with the data to send. Setting Body Content Type to JSON tells the API to expect JSON format.
  • Accessing nested data: APIs often return deeply nested JSON. Learning to navigate this structure with expressions like $json.types[0].type.name is essential for API work.

Copy the Solution

Paste into n8n with Ctrl+V to compare with your approach.

Login to see the exercise

Create an account to access challenges and track your progress.

Log in to see exercise

Related Content

Continue your learning journey with these related challenges and guides: