Registry / crm / fuel-rest

fuel-rest

JSON →
library3.2.2jsnpmunverified

Low-level Node.js library for accessing the Salesforce Marketing Cloud REST API (formerly ExactTarget). Version 3.2.2 supports Node >=4 and uses the 'request' module for HTTP calls. The community-supported project is maintained on GitHub. It provides simple GET, POST, PUT, PATCH, DELETE methods with optional retry on 401 responses. Alternative to the full FuelSDK for targeted REST calls. Release cadence: irregular, last release 2019-09-25. No ES modules, no TypeScript types. Primarily used in older Node projects integrating with Marketing Cloud.

npm install fuel-rest
INSTALL
IMPORT
SIG · FUEL-REST
F
fuel-rest
crmjavascriptv3.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FuelRest
const FuelRest = require('fuel-rest');
import FuelRest from 'fuel-rest';
Package is CJS-only, no ESM exports. Default export is the constructor function.
new FuelRest(options)
const client = new FuelRest({ auth: { clientId: 'id', clientSecret: 'secret' }});
const client = FuelRest({ auth: {} });
You must use 'new' keyword. Options object with 'auth' property is required.
instance.get/put/post/patch/delete
client.get(options).then(resp => ...);
client.get('uri', callback);
First argument must be an options object, not a string URI. Support both callback and promise, but not both.

Initializes the FuelRest client with client credentials and sends a POST request to the Marketing Cloud messaging API.

const FuelRest = require('fuel-rest'); const client = new FuelRest({ auth: { clientId: process.env.SFMC_CLIENT_ID ?? '', clientSecret: process.env.SFMC_CLIENT_SECRET ?? '' } }); client.post({ uri: '/messaging/v1/messages', body: { definitionKey: 'myDefinition', recipients: [{ contactKey: 'test@example.com' }] } }).then(response => { console.log(response.body); }).catch(err => { console.error(err); });
Debug
Known issues
deprecatedThe underlying 'request' module is deprecated. Do not use this library for new projects.
fix
Migrate to Salesforce Marketing Cloud SDK v2 or use a modern HTTP client like 'axios' with manual auth.
affects: >=1.0.0
breakingNode.js >=4 required. Will fail on Node <4.
fix
Update Node.js to version >=4 or use an older version of the package.
affects: >=3.0.0
gotchaYou cannot use both callbacks and promises on the same method call - unexpected behavior.
fix
Choose one pattern: either callback(err, response) or .then/.catch.
affects: >=1.0.0
gotcha'origin' must not have a trailing slash. e.g., 'https://www.exacttargetapis.com' not 'https://www.exacttargetapis.com/'.
fix
Remove trailing slash from origin/restEndpoint.
affects: >=1.0.0
Errors
Common errors & fixes
Error: auth options required
Missing 'auth' property in constructor options.
fix
Pass options object with auth: { clientId: '...', clientSecret: '...' }.
TypeError: FuelRest is not a constructor
Using require without 'new' keyword or wrong import syntax.
fix
Use 'new FuelRest(options)'.
Error: getaddrinfo ENOTFOUND www.exacttargetapis.com
DNS resolution failure or network issue. Often caused by incorrect origin URL.
fix
Verify the origin/restEndpoint URL. For production, use 'https://www.exacttargetapis.com' or your tenant-specific endpoint.
Upgrade
Version history
3.2.2latest on npm
Audit
Dependencies
requestrequiredHTTP client for all REST API calls (deprecated as of 2020).
fuel-authrequiredOAuth2 authentication provider for Marketing Cloud.
Agent activity
27 hits · last 30 days
node
24
Resources
fuel-rest — npm install fuel-rest · libregistry