Rest client with simplest and convenient API

Usage no npm install needed!

<script type="module">
  import easyRestClient from 'https://cdn.skypack.dev/easy-rest-client';



Travis npm version npm downloads

Rest client with simplest and convenient API.


For install stable version:

npm install --save easy-rest-client

This assumes you are using npm as your package manager.
You can use this as CommonJS module. This module is what you get when you import easy-rest-client in a Webpack, Browserify, or a Node environment.

If you don’t use a module bundler, it’s also fine. The easy-rest-client npm package includes precompiled production and development UMD builds in the dist folder. They can be used directly without a bundler and are thus compatible with many popular JavaScript module loaders and environments. For example, you can drop a UMD build as a <script>path to /dist/easy-rest-client.js</script> on the page. The UMD build make module code available as a window.easyRestClient global variable.

The source code is written in ES2015 but we precompile both CommonJS and UMD builds to ES5 so they work in any modern browser. You don’t need to use Babel or a module bundler.

Example of usage

import RestClient from 'easy-rest-client';

const client = new RestClient('https://someyourapi.host', {
    headers: {
        accept: 'application/json',
        contentType: 'application/json; charset=utf-8'
    fetch: {
        mode: 'cors',
        cache: 'default'
    trailing: false,
    interceptors: {
        request: [],
        response: []


  • RestClient as default
  • fetch
  • buildUrl
  • contentTypes