{"library":"sendgrid-rest","title":"Generic Node.js REST Client","description":"sendgrid-rest is a lightweight, generalized HTTP REST client library designed for Node.js environments. It provides a simplified, callback-based interface for making HTTP requests to any RESTful or RESTful-like API, abstracting away some of Node.js's native `http`/`https` module complexities. The package is currently at version 2.6.1, with the last release dating back to March 2020. Releases have been infrequent and focused on maintenance, documentation, and minor dependency updates (TypeScript type definitions were added in v2.6.0). This library is explicitly *not* the official SendGrid API client; for SendGrid-specific interactions, users are directed to the `@sendgrid/client` package. Its core design uses traditional CommonJS modules and callback patterns, reflecting its age, and it officially supported very old Node.js versions (0.10, 0.12, 4).","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install sendgrid-rest"],"cli":null},"imports":["const Client = require('sendgrid-rest').Client;","import type { Client } from 'sendgrid-rest';","import type { Request } from 'sendgrid-rest';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const Client = require('sendgrid-rest').Client;\nconst client = new Client();\nconst request = client.emptyRequest();\nconst param = 'myparam';\n\nrequest.host = 'api.example.com';\nrequest.headers['Authorization'] = 'Bearer XXXXXX'; // Replace XXXXXX with your actual token\nrequest.queryParams['limit'] = 100;\nrequest.queryParams['offset'] = 0;\nrequest.method = 'POST';\nrequest.path = '/your/api/' + param + '/call';\n\nconst requestBody = {\n  'some': 0,\n  'awesome': 1,\n  'data': 3\n};\nrequest.body = requestBody;\n\nclient.API(request, function (response) {\n  console.log('Status Code:', response.statusCode);\n  console.log('Response Body:', response.body);\n  console.log('Response Headers:', response.headers);\n\n  if (response.statusCode >= 400) {\n    console.error('API Error:', response.body);\n  }\n});","lang":"javascript","description":"Demonstrates how to make a POST request to a hypothetical REST API, including setting headers, query parameters, and a JSON request body using the callback-based API.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}