Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
sendgrid-rest
Advanced tools
Quickly and easily access any RESTful or RESTful-like API.
If you are looking for the SendGrid API client library, please see this repo.
All updates to this library are documented in our CHANGELOG.
You need to have a API key to use the app. To configure the API key in the environment variables follow these steps.
SENDGRID_API_KEY='<YOUR_API_KEY>';
npm install sendgrid-rest
GET /your/api/{param}/call
var Client = require('sendgrid-rest').Client
var client = new Client()
var request = client.emptyRequest()
var param = 'myparam'
request.host = 'api.example.com'
request.method = 'GET'
request.path = '/your/api/' + param + '/call'
client.API(request, function (response) {
console.log(response.statusCode)
console.log(response.body)
console.log(response.headers)
})
POST /your/api/{param}/call
with headers, query parameters and a request body.
var Client = require('sendgrid-rest').Client
var client = new Client()
var request = client.emptyRequest()
request.host = 'api.example.com'
request.headers['Authorization'] = 'Bearer XXXXXX'
request.queryParams['limit'] = 100
request.queryParams['offset'] = 0
request.method = 'POST'
var param = 'myparam'
request.path = '/your/api/' + param + '/call'
requestBody = {
'some': 0,
'awesome': 1,
'data': 3
}
request.body = requestBody
client.API(request, function (response) {
console.log(response.statusCode)
console.log(response.body)
console.log(response.headers)
})
Following is an example using SendGrid. You can get your free account here.
First, update your environment with your SENDGRID_API_KEY.
You can copy the .env_example file located in the "examples" folder to .env
in your project's root.
cp examples/.env_sample .env
Once you have edited the file and added your API Key, you can add the variable to your environment:
source .env
Here is the full working code.
To run the example:
node examples/example
======= Library Usage Documentation
Tests can be run through a Docker container which is defined in the docker-compose.yml file.
To run the tests, simply run docker-compose up
.
If you are interested in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.
We encourage contribution to our libraries, please see our CONTRIBUTING guide for details.
nodejs-http-client is guided and supported by the SendGrid Developer Experience Team.
nodejs-http-client is maintained and funded by SendGrid, Inc. The names and logos for nodejs-http-client are trademarks of SendGrid, Inc.
FAQs
HTTP REST client, simplified for Node.js.
The npm package sendgrid-rest receives a total of 39,052 weekly downloads. As such, sendgrid-rest popularity was classified as popular.
We found that sendgrid-rest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.