UPS - Get Rates
Description
Section titled “Description”This module queries the available UPS shipping rates for a given package. It receives the shipper and recipient data in JSON format, weight, optional dimensions, and optional service type. It makes a POST request to the /api/rating/v1/Rate endpoint with the RateRequest payload. It processes the response to extract the service code and name, total charges, currency, base charges, service options charges, guaranteed days, and delivery time. It identifies the cheapest rate.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | UPS credential (provider: ups) |
| shipper | textarea | Yes | Shipper data in JSON with Name and Address |
| ship_to | textarea | Yes | Recipient data in JSON with Name and Address |
| package_weight | text | Yes | Package weight in kilograms |
| package_dimensions | textarea | No | Dimensions in JSON (Length, Width, Height) |
| service_code | select | No | Filter by service: 01 (Next Day Air), 02 (2nd Day Air), 03 (Ground), 07 (Express), 08 (Expedited), 11 (Standard), 65 (Saver). Empty for all |
Credentials
Section titled “Credentials”A ups type credential is required with the following fields:
- client_id: UPS API Client ID
- client_secret: UPS API Client Secret
Output
Section titled “Output”{ "success": true, "rates": [ { "service_code": "11", "service_name": "Standard", "total_charges": "18.50", "currency": "EUR", "base_charges": "15.00", "service_options_charges": "3.50", "guaranteed_days": "3", "delivery_by": "23:30" } ], "rates_count": 4, "cheapest": { "service_code": "11", "service_name": "Standard", "total_charges": "18.50", "currency": "EUR" }, "message": "4 tarifas UPS obtenidas"}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "credentials_id": "mi_credencial_ups", "shipper": "{\"Name\":\"Mi Empresa\",\"Address\":{\"AddressLine\":[\"Calle Gran Via 1\"],\"City\":\"Madrid\",\"PostalCode\":\"28001\",\"CountryCode\":\"ES\"}}", "ship_to": "{\"Name\":\"Cliente\",\"Address\":{\"AddressLine\":[\"Av Diagonal 100\"],\"City\":\"Barcelona\",\"PostalCode\":\"08001\",\"CountryCode\":\"ES\"}}", "package_weight": "2.0"}API Used
Section titled “API Used”- Endpoint: POST
/api/rating/v1/Rate - Base: UPS API (via helper
_upsHelper) - Documentation: https://developer.ups.com/api/reference
- If no service is specified, all available options are returned
- The response can be an object or an array; the module handles both cases
- Dimensions are optional and expressed in centimeters
- ShipFrom is automatically configured the same as Shipper