npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

rets-rabbit-js

v1.0.8

Published

Javascript SDK for the Rets Rabbit API

Readme

Rets-Rabbit-Javascript-SDK

Vanilla javascript sdk for the Rets Rabbit (RR) API.

Install the library

# via npm
$ npm install rets-rabbit-js

# via bower
$ bower install rets-rabbit-js

Configure a new client

There are several configuration options which you can use when instantiating a new Rets Rabbit client.

var rrClient = new RetsRabbit({
   clientId: 'YOUR_CLIENT_ID',
   clientSecret: 'YOUR_CLIENT_SECRET',
   host: 'https',
   url: 'stage.retsrabbit.com/api',
   storageKey: 'token' //default is 'access_token'
});

If you do not supply your own clientId or clientSecret, the test Rets Rabbit credentials will be used which will give you access to our test data store.

You may configure your RR credentials after instantiating your client with the following methods:

var rrClient = new RetsRabbit({});

rrClient.clientId('YOUR_NEW_CLIENT_ID'); //update clientId

rrClient.clientSecret('YOUR_NEW_CLIENT_SECRET'); //update clientSecret

rrClient.host('YOUR_NEW_HOST'); //update host (http|https) default: http

rrClient.url('YOUR_NEW_URL'); //update url, default: stage.retsrabbit.com

rrClient.storageKey('NEW_KEY_NAME'); //update localStorage token key name
                                    //default: 'access_token'

Loading

Make sure you wrap any of your logic inside of a .ready() callback to ensure the library is fully loaded.

RetsRabbit.ready(function () {
    //authenticate or perform request
});

Authentication

The RR library exposes a method auth() which hits the OAUTH 2.0 endpoint to receive a new access token. By default this method stores the access_token in a localStorage key called 'access_token', but this can be configured.

var rrClient = new RetsRabbit({});

RetsRabbit.ready(function () {
    rrClient.auth(function (err, res){
        if(err){
            //handle error
        } else {
            //grab token
            var token = res.access_token;
        }
    });
});

Querying

There are currently two version of the RR API: v1 & v2. This package supports querying against both endpoints, by simply changing the url your GET request is pointed at.

V1

rrClient.get('/v1/rest-of-path', ...) //v1 query string

To learn more about querying the v1 endpoint go check out our [v1 docs] (https://retsrabbit.com/docs) .

V2

rrClient.get('/v2/rest-of-path', ...) //v2 query string

The latest version (v2) of RR is ODATA v4 compliant which means we offer support for these types of query expressions:

$filter=ListPrice gt 75000 and geo.distance(location, POINT(-127.89734578345 45.234534534)) lt 50

$select=ListPrice, ListingId, OriginaListPrice

$orderby=ListPrice desc

$skip=10

$top=10

See the RR v2 docs for more details on how to interact with our data. If reading through documentation isn't your kind of thing we have an API explorer which allows you to interactively play with v2 of the API in an intuitive and fun way!

###Get Request In order to perform queries against with the RR API, this module exposes a get() request method which accepts a request parameter.

var rrClient = new RetsRabbit();

RetsRabbit.ready(function () {
    var q = {
        '$top': 10, 
        '$select': 'ListingId, ListPrice'
    };
    
    //third param is for the access_token if you want directly
    //pass it in, but it pulls from localStorage by default
    rrClient.get('/v2/property', q, null, function (err, res){
        if(err){
            //handle error
        } else {
           var listings = res.value;
           //do awesome stuff with listings
        }
    });
});