Step 1: Set Up Your n8n Project
- Log in to your n8n account.
- Click New Workflow to create a blank workflow.
- Give the workflow a descriptive name.
Step 2: Define Input Variables
- Add an Edit Fields node:
- This node creates input variables for the API call.
- Define input fields as text variables:
- originZIP
- destinationZIP
- weight
- Ensure inputs are stored in text format, as required by the API.
Step 3: Import API Request via cURL
- Visit the SpreadsheetWeb API Documentation.
- Navigate to the
calculatesinglesimpleendpoint:- Use the Try it out feature to test with sample inputs.
- Copy the cURL request provided after execution.
Example cURL: - Add an HTTP Request node to n8n:
- Click Import cURL and paste the cURL command.
Step 4: Configure the HTTP Request Node
- Verify Parameters: Ensure the following details are accurate:
- API Endpoint:
https://api.spreadsheetweb.com/calculations/calculatesinglesimple
- Headers:
Content-Type: application/json
- Body: Map the request body to dynamic input fields:
Replace
workspaceIdandapplicationIdwith your SpreadsheetWeb credentials. - API Endpoint:
- Map variables to the request body:
- Drag and drop originZIP, destinationZIP, and weight from the Edit Fields node to the JSON body.
Step 5: Handle API Response
- Add a second Edit Fields node to handle the API response.
- Extract and store the API output:
- Define a new field: calculatedCost.
- Map it to the key in the API response:
Step 6: Test the Workflow
- Run the workflow with sample inputs:
- originZIP: “10001”
- destinationZIP: “90001”
- weight: “1”
- Verify the output:
- The
calculatedCostfield should display the API result (e.g., “8.5785”).
- The