Step 1: Set Up the Xano Database

  1. Navigate to the Database:
    • In Xano, go to the Database section from the left menu.
  2. Add a Table:
    • Click Add TableEnter Manually.
    • Add the following columns:
      • originZIP (Text)
      • destinationZIP (Text)
      • weight (Number)
      • Optional: cost (Number, for storing the API response).

This database will dynamically store inputs and results.

Step 2: Create the API Group and Custom Endpoint

  1. Go to the API section.
  2. Add an API Group:
    • Click Add API Group and name it (e.g., “SpreadsheetWeb Integration”).
  3. Create a Custom Endpoint:
    • Click Add API Endpoint → Select Custom Endpoint.

Step 3: Configure the External API Request

  1. Import the SpreadsheetWeb API cURL:
    • Visit the SpreadsheetWeb API documentation.
    • Go to the calculatesinglesimple path → Click Try it outExecute.
    • Copy the generated cURL Request.
  2. Import into Xano:
    • In your custom endpoint, click Add Function → Select External API Request.
    • Click Import cURL and paste the following structure:
      { "request": { "workspaceId": "your-workspace-id", "applicationId": "your-application-id", "inputs": { "originZIP": "10001", "destinationZIP": "90001", "weight": "1" }, "outputs": ["cost"] } }
    • Replace placeholders with your Workspace ID and Application ID.
  3. Set Headers:
    • Add a Header:
      • Content-Type: application/json

Step 4: Add Dynamic Input Fields

  1. Go to the Input Values section of your endpoint.
  2. Define dynamic input fields:
    • originZIP → Map to API’s originZIP.
    • destinationZIP → Map to API’s destinationZIP.
    • weight → Map to API’s weight.

This setup ensures that API inputs are dynamically sent.

Step 5: Test the API

  1. Use Xano’s Run & Debug feature to test the API:
    • Input sample values for originZIP, destinationZIP, and weight.
  2. Verify that the cost field is returned in the response.
    Example Response:

    { "response": { "outputs": { "cost": "8.5785" } } }

Step 6: Save Test Data in the Database (Optional)

  1. Add a Database Function in the endpoint to save inputs and outputs.
  2. Map:
    • originZIP → Database originZIP
    • destinationZIP → Database destinationZIP
    • weight → Database weight
    • cost → Database cost (from API response).