From 48578bbacaa2cc5000d6ba3e52a8bb6a667c56ba Mon Sep 17 00:00:00 2001 From: Deborah Barnard Date: Tue, 14 Jun 2022 17:01:05 +0100 Subject: [PATCH] wip --- .../creating-nodes/http-helpers.md | 20 +++++------ .../creating-nodes/review-checklist.md | 35 ++++++++++--------- styles/Vocab/default/accept.txt | 2 ++ 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/docs/integrations/creating-nodes/http-helpers.md b/docs/integrations/creating-nodes/http-helpers.md index c13fbf15d..8eb47bae2 100644 --- a/docs/integrations/creating-nodes/http-helpers.md +++ b/docs/integrations/creating-nodes/http-helpers.md @@ -3,15 +3,15 @@ !!! note "Programmatic style only" The information in this document is for node building using the programmatic style. It doesn't apply to declarative style nodes. -While creating nodes it is very commonn to call external APIs or make HTTP requests to other services. +It's common to call external APIs or make HTTP requests to other services from a node. This plays a major role during node development, maintenance, and improvements. -We provide a very flexible helper for making HTTP requests that abstracts away most of the complexity with a simple to use interface. +n8n provides a flexible helper for making HTTP requests that abstracts away most of the complexity. ## How to use -In the node code, inside the `execute` function you can easily call: +Call the helper inside the `execute` function: ```typescript const response = await this.helpers.httpRequest(options); @@ -49,16 +49,16 @@ Where `options` is an object in this format: } ``` -Where `url` is the only mandatory field. The default method is `GET`. +`url` is required. The other fields are optional. The default method is `GET`. Some notes about the possible fields: -- **body**: You can use a regular Javascript Object for JSON payload, a Buffer for file uploads, an instance of FormData for `multipart/form-data` and `URLSearchParams` for `application/x-www-form-urlencoded`. -- **headers**: A simple key-value pair. - * If `body` is an instance of `FormData` then `content-type: multipart/form-data` is injected automatically. - * If `body` is an instance of `URLSearchParams`, then `content-type: application/x-www-form-urlencoded` is added. - * To override this behavior, you can set any `content-type` header you wish and it won't be overridden. -- **arrayFormat**: If your query string contains an array of data, let's say `const qs = {IDs: [15,17]}`, the values set to `arrayFormat` define how it will be sent. +- `body`: you can use a regular JavaScript object for JSON payload, a buffer for file uploads, an instance of FormData for `multipart/form-data`, and `URLSearchParams` for `application/x-www-form-urlencoded`. +- `headers`: a key-value pair. + * If `body` is an instance of `FormData` then n8n adds `content-type: multipart/form-data` automatically. + * If `body` is an instance of `URLSearchParams`, then n8n adds `content-type: application/x-www-form-urlencoded`. + * To override this behavior, set a `content-type` header. +- `arrayFormat`: if your query string contains an array of data, such as `const qs = {IDs: [15,17]}`, the value of `arrayFormat` defines how n8n sends it. * `indices` (default): `{ a: ['b', 'c'] }` will be formatted as `a[0]=b&a[1]=c` * `brackets`: `{ a: ['b', 'c'] }` will be formatted as `a[]=b&a[]=c` * `repeat`: `{ a: ['b', 'c'] }` will be formatted as `a=b&a=c` diff --git a/docs/integrations/creating-nodes/review-checklist.md b/docs/integrations/creating-nodes/review-checklist.md index 5b2edcc5d..afff723ce 100644 --- a/docs/integrations/creating-nodes/review-checklist.md +++ b/docs/integrations/creating-nodes/review-checklist.md @@ -11,7 +11,7 @@ This checklist helps you build a node that meets the standards for submission to If you're' creating a node requested by a community member, make sure to comment on the feature request in the [community forum](https://community.n8n.io/c/feature-requests/5).
Add complementary operations to each resource (for example, create, delete)
- Check the node works with more than one item using one input.
[TODO: what does this mean?] + Check the node works with more than one item using one input.[TODO: what does this mean?]
Ensure the parameters have the correct type.
Mind the defaults: if the service has a default as true, keep it as true. Changing default values can break the existing workflows of the users.
Check if the node disposes of everything. In particular, the node has closed all connections.
@@ -28,42 +28,45 @@ This checklist helps you build a node that meets the standards for submission to Ensure the indentation is correct. Check this in the editor configuration.
Ensure there are no extra spaces. Check this in the editor configuration.
Code comment dividers inside if-branches.
- Use "create/delete" verbs for operations, except for tags, where you should use "add/remove".
+ Use "create/delete" verbs for operations, except for tags, where you should use "add/remove."
## Errors and Outputs Ensure empty API responses return `{ success: true }`.
- Ensure the node handles and displays error responses correctly (for example, malformed requests, requests with invalid credentials) and use the current format. You can check this by making failing requests to the API.
- Check if the response can be simplified and add a simplify function (for example, SecurityScorecard node).
+ Ensure the node handles and displays error responses (for example, malformed requests, requests with invalid credentials) and use the current format. You can check this by making failing requests to the API.
+ Check if you can simplify the response. If so, add a simplify function (for example, SecurityScorecard node).
Ensure the response from `Create` is consistent with `Get`.
Ensure the response from `Get All` is consistent with `Get`.
## Presentation - The primary menu should only contain required parameters.
+ The primary menu shouldn't contain optional parameters.
Ensure a JSON object isn't shown in a single column in Table view.
Make sure all GetAll operations have the fields `return` and `limit`.
Set the property subtitle.
- Make sure the pagination (if any) is working correctly. Set Limit 1.
+ Make sure the pagination (if any) is working. Set Limit 1.
## Writing Ensure all descriptions are correct and end with a period.
Ensure that most descriptions exist, excluding redundant ones.
- Ensure IDs in displayNames are capitalized (for example: "IDs" not "ids" or "Ids").
- Ensure that IDs, if multiple, have descriptive qualifiers.
- Ensure the `name` property in `description` in the node class is written in camelCase.
- Ensure the file name and the Class name are identical.
+ Capitalize IDs in displayNames (for example: "IDs" not "ids" or "Ids").
+ If there is more than one ID, ensure they have descriptive qualifiers.
+ Ensure the `name` property in `description` in the node class is in camelCase.
+ Ensure the file name and the class name are identical.
## Branding - - Ensure the name of the service is written correctly (e.g., "GitHub" not "Github"). If the node is a trigger node, ensure it is named as such, by adding "Trigger" after the service name (e.g., "Trello Trigger").
+ + Check that brand names are correct (for example, "GitHub" not "Github").
+If the node is a trigger node, show this in the name by adding "Trigger" after the service name (for example, "Trello Trigger").
Ensure the logo is either a PNG or SVG, ideally the latter. Vecta is a good website to find SVGs of different applications.
- If the logo is an SVG, ensure the canvas is a perfect square. If the logo is PNG, ensure it is 60x60 pixels and compressed.
+ If the logo is an SVG, ensure the canvas is a perfect square. If the logo is PNG, ensure it's 60x60 pixels and compressed.
Ensure the border color of the node matches the branding of the service.
+ ## Nice-to-haves (optional) - Add handler for `continueOnFail`. This feature is included in some of the newest nodes (e.g Lemlist node) to continue the workflow even if the node's execution fails.
- Remove `required: false` and `description: ''` in the node descriptions (e.g., Lemlist node).
+ + Add handler for `continueOnFail`. This handler continues the workflow even if the node's execution fails.
+ Remove `required: false` and `description: ''` in the node descriptions (for example, Lemlist node).
At call site, specify first `body` and then `qs`.
- At call site, prepend the endpoint with slash `/` (e.g., "/campaign").
\ No newline at end of file + At call site, prepend the endpoint with slash `/` (for example, "/campaign").
\ No newline at end of file diff --git a/styles/Vocab/default/accept.txt b/styles/Vocab/default/accept.txt index df8bd0e32..e3a98c3b0 100644 --- a/styles/Vocab/default/accept.txt +++ b/styles/Vocab/default/accept.txt @@ -5,8 +5,10 @@ Enum enum GIMP invalid +Lemlist n8n namespace npm onboarding +Trello URL \ No newline at end of file