{"library":"node-rest-client","title":"Node.js REST Client","description":"node-rest-client is a versatile Node.js library for interacting with RESTful APIs, designed to simplify HTTP/HTTPS requests. It offers features such as transparent handling of HTTP/HTTPS connections, basic authentication, and support for common HTTP methods (GET, POST, PUT, DELETE, PATCH), with the ability to define custom methods. A key differentiator is its capability to register remote API operations as reusable client methods, streamlining code and promoting reuse. The library also manages dynamic path and query parameters, request headers, provides improved error handling, supports compressed responses (gzip, deflate), follows redirects (via `follow-redirects`), and allows for custom request serializers and response parsers (with JSON and XML included by default). The current stable version is 3.1.1. Release cadence is not strictly scheduled, but the project shows active development with recent major and minor updates.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-rest-client"],"cli":null},"imports":["const Client = require('node-rest-client').Client;","const nodeRestClient = require('node-rest-client');\nconst Client = nodeRestClient.Client;","client.registerMethod('myMethod', 'http://example.com/api', 'GET');\nclient.methods.myMethod(function(data, response){ /* ... */ });"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const Client = require('node-rest-client').Client;\n\nconst client = new Client();\n\n// Example: Simple HTTP GET request\nclient.get(\"https://jsonplaceholder.typicode.com/posts/1\", function (data, response) {\n\t// parsed response body as js object\n\tconsole.log('GET Response Data:', data);\n\t// raw response\n\tconsole.log('GET Response Status:', response.statusCode);\n});\n\n// Example: HTTP POST request with JSON data and headers\nconst args = {\n\tdata: { title: 'foo', body: 'bar', userId: 1 },\n\theaders: { \"Content-Type\": \"application/json\" }\n};\n\nclient.post(\"https://jsonplaceholder.typicode.com/posts\", args, function (data, response) {\n\tconsole.log('POST Response Data:', data);\n\tconsole.log('POST Response Status:', response.statusCode);\n});","lang":"javascript","description":"This quickstart demonstrates how to install `node-rest-client` and perform both a simple HTTP GET request and an HTTP POST request with JSON data and headers to a public API.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}