Overview
This node is an example custom n8n node designed to demonstrate how to create and manage resources such as users and products. Specifically, for the "用户" (User) resource with the "创建" (Create) operation, it allows creating a new user by providing user data fields like first name, last name, and email. The node then returns the newly created user's information including a generated ID and creation timestamp.
Common scenarios where this node would be beneficial include:
- Automating user account creation workflows.
- Integrating user management into larger automation pipelines.
- Testing or prototyping API interactions related to user data.
Practical example: You can use this node to create a new user in your system by specifying their first name, last name, and email address. The node will simulate generating a unique user ID and timestamp the creation time.
Properties
| Name | Meaning |
|---|---|
| 用户数据 | A collection of fields describing the user to create. Includes: |
| - 名字 (firstName): The user's first name | |
| - 姓氏 (lastName): The user's last name | |
| - 电子邮件 (email): The user's email address |
Output
The node outputs a JSON array containing one object representing the created user. The structure includes:
id: A string representing the new user's unique identifier (simulated as"新ID").firstName: The user's first name as provided.lastName: The user's last name as provided.email: The user's email address as provided.createdAt: An ISO 8601 timestamp string indicating when the user was created.
Example output JSON:
[
{
"id": "新ID",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"createdAt": "2024-06-01T12:00:00.000Z"
}
]
No binary data output is produced by this node.
Dependencies
- This node requires an API key credential configured in n8n (referred generically as "an API key credential").
- No external services are explicitly called in the example code; it simulates data creation internally.
- The node depends on standard n8n helper methods for parameter retrieval and returning JSON arrays.
Troubleshooting
- Common issues:
- Missing required user data fields (e.g., first name or email) may cause incomplete user creation.
- If the node throws errors, ensure that all required input properties are correctly set.
- Error messages:
- Errors thrown during execution will be returned as JSON objects with an
errorfield if "Continue On Fail" is enabled. - Typical error might be related to missing parameters or invalid data types.
- Errors thrown during execution will be returned as JSON objects with an
- Resolution:
- Verify that the input properties match the expected types and are not empty.
- Enable "Continue On Fail" to handle errors gracefully within workflows.