A simple-to-use HTTP REST API client for Node.js supporting GET, POST, PUT, DELETE, PATCH, and custom methods. Version 4.0.0 provides transparent HTTP/HTTPS connections, basic authentication, proxy support, dynamic path and query parameters, custom request serializers (JSON, XML, url-encoded), custom response parsers (JSON, XML), compressed response handling (gzip, deflate), and follow-redirects. It allows registering remote API operations as client methods. Latest stable release has irregular release cadence; key differentiator is its simple callback-based API without promises, but it lacks TypeScript support.
npm install node-rest-api-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows direct GET, registered method with path substitution, and POST with JSON data and headers.
Always set 'Content-Type' header (e.g., 'application/json') in the headers argument for methods that send a body.
Use template literal-style placeholders in URL: 'http://example.com/resource/${id}' and pass { path: { id: value } }.Use function(data, response) { ... } with data first, response second.Remove followRedirects option; redirect handling is automatic.
Explicitly set headers: { 'Content-Type': 'application/json' } when sending JSON payloads.Use const { Client } = require('node-rest-client');Run npm install node-rest-client --save, which will install follow-redirects as a dependency.
Add headers: { 'Content-Type': 'application/json' } to the args object.Call client.registerMethod(name, url, verb) before accessing client.methods.name.