Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

api-http

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-http

Simple Node.js class for performing HTTP API requests.

  • 2.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

api-http

NPM Version Build Status

Simple Node.js class for performing HTTP requests.

npm install api-http

Example Usage

import ApiHttp from 'api-http';

const facebook = new APIHTTP('https://graph.facebook.com/v2.5/');

const person = await facebook.get('me')
console.log(person.first_name);

Methods

.get(), .delete(), .head()

Arguments: [path, query]

Example Usage:

var api = require('api-http')('http://example.com/');
// http://example.com/users?online=true
api.get('users', {online: true});

.post(), .patch(), .put(), ... etc.

Arguments: [path, body, query]

Example Usage:

api.post('customers', {
  firstName: 'John',
  lastName: 'Smith'
});

.withAccessToken(accessToken)

Create a new APIHTTP client scoped with an OAuth Bearer access token:

Example:

facebook.withAccessToken('2348923984324').get('me')

.withBasicAuth(username, password)

Create a new APIHTTP client scoped with a Basic Access Authorization header:

Example:

api.withBasicAuth('Aladdin', 'open sesame').get('something/x/y')

Keywords

FAQs

Package last updated on 12 May 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc