diff --git a/docs/courses/level-two/chapter-1.md b/docs/courses/level-two/chapter-1.md index a3ba0cb05..581c25637 100644 --- a/docs/courses/level-two/chapter-1.md +++ b/docs/courses/level-two/chapter-1.md @@ -189,37 +189,30 @@ There are several ways to transform data for the purposes mentioned above: ### Exercise -Use the HTTP Request node to make a GET request to the Poemist API `https://www.poemist.com/api/v1/randompoems`. Transform the incoming data with the `Split Into Items` option and with the Code node. +Use the HTTP Request node to make a GET request to the Poetry DB API `https://poetrydb.org/linecount/3`. Transform the incoming data with the Item Lists node and with the Code node. ??? note "Show me the solution" - To get the poems from the Poemist API, execute the *HTTP Request node* with the following parameters: + To get the poems from the Poetry DB API, execute the *HTTP Request node* with the following parameters: - Authentication: None - Request Method: GET - - URL: https://www.poemist.com/api/v1/randompoems + - URL: https://poetrydb.org/linecount/3 + - Options > Response: Include Response Headers and Status - The result should look like this: - -
HTTP Request node without split items
- - - To transform the data from the HTTP Request node, toggle the switch `Split Into Items`. The result should look like this: - -
HTTP Request node with split items
- - To transform the data with the Code node, connect this node to the *HTTP Request node* (without the toggle for splitting data) and write the following code in the JavaScript Code field: + To transform the data with the Code node, connect this node to the *HTTP Request node* and write the following code in the JavaScript Code field: ```js - return items[0].json.map(item => { + return items[0].json.body.map(item => { return { json: item } }); ``` - The result should look like this: - -
Code node with code to transform items
- + To transform the data with the Item Lists node, connect this node to the *HTTP Request node* and set the following parameters: + + - Operation: Split Out Items + - Field To Split Out: body + - Include: No Other Fields