All Projects → zxol → Airbnbapi

zxol / Airbnbapi

Licence: mit
Unofficial airbnb.com REST API wrapper for node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Airbnbapi

Ng Gapi
ng-gapi a Google api module for Angular 6+
Stars: ✭ 126 (-3.08%)
Mutual labels:  api
Zabbixapi
Ruby wrapper to Zabbix API
Stars: ✭ 128 (-1.54%)
Mutual labels:  api
Sabisu Rails
Simple and powerful engine for exploring your Rails api application
Stars: ✭ 129 (-0.77%)
Mutual labels:  api
Abstracting Fastapi Services
FastAPI application and service structure for a more maintainable codebase – See full article
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Geeksay
🤓 geeks will ctrl+s the world!
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Slacker
Full-featured Python interface for the Slack API
Stars: ✭ 1,615 (+1142.31%)
Mutual labels:  api
Ajax Movie Recommendation System With Sentiment Analysis
Content-Based Recommender System recommends movies similar to the movie user likes and analyses the sentiments on the reviews given by the user for that movie.
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Ergo Pe Av
🧠 🦠 An artificial neural network and API to detect Windows malware, based on Ergo and LIEF.
Stars: ✭ 130 (+0%)
Mutual labels:  api
Api Common Protos
A standard library for use in specifying protocol buffer APIs.
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Augur.js
Augur JavaScript API
Stars: ✭ 129 (-0.77%)
Mutual labels:  api
Pfsense Api
The missing REST API package for pfSense
Stars: ✭ 126 (-3.08%)
Mutual labels:  api
Ewelink Api
eWeLink API for JavaScript
Stars: ✭ 128 (-1.54%)
Mutual labels:  api
Hyperapp One
Hyperapp One is a Parcel boilerplate for quickstarting a web application with Hyperapp (V1), JSX, and Prettier.
Stars: ✭ 129 (-0.77%)
Mutual labels:  airbnb
Pokemongoapi Php
Pokemon Go API PHP library
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Reddit Detective
Play detective on Reddit: Discover political disinformation campaigns, secret influencers and more
Stars: ✭ 129 (-0.77%)
Mutual labels:  api
Dm env
A Python interface for reinforcement learning environments
Stars: ✭ 127 (-2.31%)
Mutual labels:  api
Scobot
SCORM API for Content. JavaScript library, QUnit tests and examples.
Stars: ✭ 128 (-1.54%)
Mutual labels:  api
Apidemo
快应用API Demo 集合 QuickAPP
Stars: ✭ 129 (-0.77%)
Mutual labels:  api
Tiktokbot
A TikTokBot that downloads trending tiktok videos and compiles them using FFmpeg
Stars: ✭ 126 (-3.08%)
Mutual labels:  api
N26
💳 Un-official node.js module for interact with your N26 (previously Number26) account
Stars: ✭ 128 (-1.54%)
Mutual labels:  api

Breaking changes ahead!

Version 0.11.0, due to be released sometime after July 1st. Errors will no longer return null values. Instead, errors will be thrown.

Unofficial airbnb.com REST API wrapper for node.js


Coverage Status


Hi there! 👋 This is a javascript library for interacting with airbnb's API.
Disclaimer: this library is not associated with airbnb and should only be used for educational reasons. It is an interface for a private API used by airbnb's mobile applications.
This is a pre 1.0 library. Please request endpoints and functionality as repo issues. Collaborators wanted!

Essential Info

  • All functions return promises.
  • The returned data format is pre-parsed JSON, i.e. a javascript object. Multiple records will be returned as an array.
  • The auth system is a simple crypto token. For the uninitiated, this is like a username and password in one. If you're only using a single account, you can supply a token with .setDefaultToken(), otherwise, you will have to supply a token with every function call.
  • Yeah, I know, airlock is a massive pain in the posterior.
  • Error reporting and data validation is spotty at this stage!
  • This library only has one dependency - request-promise.

Getting started 👨‍💻

Installing

npm install airbnbapijs

Importing

var airbnb = require('airbnbapijs')

or es6...

import airbnb from 'airbnbapijs'

Reference 📗

Contents

  1. Authorization
  2. Users
  3. Calendars
  4. Listings
  5. Threads
  6. Reservations
  7. Posting
  8. Configuration

AUTHORIZATION

testAuth

Test a token

airbnb.testAuth('faketoken3sDdfvtF9if5398j0v5nui')
// returns bool

newAccessToken

Request a new token

airbnb.newAccessToken({ username: '[email protected]', password: 'hunter2' })
// returns {token: 'faketoken3sDdfvtF9if5398j0v5nui'} or {error: {error obj}}

login

Request a new token (v2 endpoint). Similar to the above function but returns a user info summary with much more information.

airbnb.login({ username: '[email protected]', password: 'hunter2' })
// returns a user info object (includes token) or {error: {error obj}}

setDefaultToken

Set the token to use if a token is not supplied for an endpoint function.

airbnb.setDefaultToken('faketoken3sDdfvtF9if5398j0v5nui')

TODO: support other login methods (facebook, twitter, etc...)


USERS

getGuestInfo

Get a user's public facing information

airbnb.getGuestInfo(2348485493)
// returns public info about user (JSON)

getOwnUserInfo

Obtain user data for the logged in account

airbnb.getOwnUserInfo('faketoken3sDdfvtF9if5398j0v5nui')
// returns private info about user (JSON)

CALENDARS

getPublicListingCalendar

Public availability and price data on a listing. count is the duration in months.

airbnb.getPublicListingCalendar({
    id: 109834757,
    month: 1,
    year: 2018,
    count: 1
})
// returns array of calendar days, with availability and price

getCalendar

Private calendar data regarding your listings. Reservations, cancellations, prices, blocked days.

airbnb.getCalendar({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 109834757,
    startDate: '2018-01-01',
    endDate: '2018-02-28'
})
// returns array of calendar days with extended info, for your listings

setPriceForDay

Set a price for a day.

airbnb.setPriceForDay({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 109834757,
    date: '2018-01-01',
    price: 1203
})
// returns a result of the operation

setAvailabilityForDay

Set availability for a day.

airbnb.setAvailabilityForDay({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 109834757,
    date: '2018-01-01',
    availability: 'available' // or 'blocked'?
})
// returns a result of the operation

LISTINGS

listingSearch

Airbnb's mighty search bar in JSON form. All arguments are optional.

airbnb.listingSearch({
    location: 'Akihabara, Tokyo',
    checkin: '2020-01-21',
    checkout: '2020-02-10',
    offset: 0,
    limit: 20,
    language: 'en-US',
    currency: 'USD',
    guests: 6, // Number of guests for price quote
    instantBook: true, // only list instant bookable listings.
    minBathrooms: 0,
    minBedrooms: 2,
    minBeds: 6,
    minPrice: 0,
    maxPrice: 0,
    superhost: true,
    amenities: [1, 2, 4, 23], // array of IDs.
    hostLanguages: [1, 3, 6], // array of IDs.
    keywords: 'ocean view,garden,quiet', //comma separated
    roomTypes: ['Entire home/apt', 'Private room', 'Shared room'],
    neighborhoods: ['westside', 'riverside'],
    minPicCount: 4,
    sortDirection: 1 // 1 = forward, 0 = reverse
})
// returns an array of listings

getListingInfo

Gets public facing data on any listing.

airbnb.getListingInfo(109834757)
// returns public info for any listing (JSON)

getListingInfoHost

Gets private data on one of your listings.

airbnb.getListingInfoHost({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 109834757
})
// returns extended listing info for your listing (JSON)

getHostSummary

Gets an object containing a host's active listings, alerts, and upcoming reservations

airbnb.getHostSummary('faketoken3sDdfvtF9if5398j0v5nui')
// returns host summary info for your account (JSON)

getOwnActiveListings

Gets an array containing a host's active listings

airbnb.getOwnActiveListings('faketoken3sDdfvtF9if5398j0v5nui')
// returns listing array for your account (JSON)

getOwnListings

Gets an array containing a host's listings

airbnb.getOwnListings({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    userId: '2344594'
})
// returns listing array for your account (JSON)

THREADS

getThread

Returns a conversation with a guest or host. This is a legacy endpoint which is somewhat limited in the content (only basic messages are reported in the 'posts' array)

airbnb.getThread({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 909878797
})
// returns a single thread in the legacy format (JSON)

getThreads

A simple list of thread ID's, ordered by latest update. The offset is how many to skip, and the limit is how many to report.

airbnb.getThreads({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    offset: 0,
    limit: 20
})
// returns an array of thread IDS (only the ids, ordered by latest update) (JSON)

getThreadsFull

This is the best way to pull thread data. Returns an array of full thread data, ordered by latest update. The offset is how many to skip, and the limit is how many to report.

airbnb.getThreadsFull({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    offset: 0,
    limit: 10
})
// returns an array of threads in the new format, ordered by latest update (JSON)

getThreadsBatch

A batch version of the above. You can grab a collection of threads referenced by thread ID.

airbnb.getThreadsBatch({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    ids: [23049848, 203495875, 398328244]
})
// returns an array of threads in the new format (JSON)

RESERVATIONS

getReservation

Reservation data for one reservation.

airbnb.getReservation({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 909878797
})
// returns a single reservation in the mobile app format (JSON)

getReservations

Returns a list of reservations in the same format as above, ordered by latest update

airbnb.getReservations({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    offset: 0,
    limit: 10
})
// returns an array of reservations in the mobile app format, ordered by latest update (JSON)

getReservationsBatch

Batch call for grabbing a list of reservations by ID.

airbnb.getReservationsBatch({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    ids: [98769876, 98769543, 98756745]
})
// returns an array of reservations in the new format (JSON)

POSTING

sendMessage

Send a message to a thread.

airbnb.sendMessage({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 2039448789,
    message: 'Hi there!'
})
// returns confirmation

sendPreApproval

Send a pre-approval to a guest.

airbnb.sendPreApproval({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    thread_id: 2039448789,
    listing_id: 340598483,
    message: ''
})
// returns confirmation

sendReview

Send a review to a guest after they have checked out. (id is the thread id)

airbnb.sendReview({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    id: 2039448789,
    comments: 'They were great guests!',
    private_feedback: 'Thank you for staying!',
    cleanliness: 5,
    communication: 5,
    respect_house_rules: 5,
    recommend: true
})
// returns confirmation

sendSpecialOffer

Send a special offer to a guest.

airbnb.sendSpecialOffer({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    check_in: '2018-10-13T00:00:00+00:00',
    guests: 1,
    listing_id: 9876676,
    nights: 1,
    price: 100000,
    thread_id: 98766767,
    currency: 'USD'
})
// returns confirmation

alterationRequestResponse

Send a "reservation alteration request response" to a guest
To accept the request, supply the decision prop with true
To decline the request, supply the decision prop with false

alterationRequestResponse({
    token: 'faketoken3sDdfvtF9if5398j0v5nui',
    reservationId: 23049459,
    alterationId: 2134094,
    decision: true,
    currency: 'USD'
})
// returns alteration object, or an error object.

CONFIGURATION

setConfig

Set multiple config variables at once

setConfig({
    defaultToken: 'faketoken3sDdfvtF9if5398j0v5nui',
    apiKey: '01123581321345589144233377610987',
    currency: 'USD',
    userAgent: 'Mosaic/0.9',
    proxy: 'myproxy.com'
})

setDefaultToken

Set the token to use if a token is not supplied for an endpoint function.

airbnb.setDefaultToken('faketoken3sDdfvtF9if5398j0v5nui')

setApiKey

Use an api key different from the standard one

airbnb.setApiKey('01123581321345589144233377610987')

setCurrency

Set the default currency (the default is JPY, sorry USA)

airbnb.setCurrency('USD')

setUserAgent

set the user agent string for the requests

airbnb.setUserAgent('Mosaic/0.9')

setProxy

set a proxy server to run traffic through

airbnb.setProxy('myproxy.com')
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].