Skip to main content

Overview

Learn about the EV API Wrapper.

General Info

  1. The EV API Wrapper is located in web/util/api/ev.ts. It is designed to simplify the interactions between the frontend and EV's API.
  2. It provides helpful functions for controlling pagination, get requests, post requests, and even adding URL params automatically.
  3. Unifies managing the API in one place to prevent redundant implementations of the API

How to use EV API Wrapper

  1. Import the wrapper
import evAPI from "@util/api/ev";
let api = new evAPI();
  1. Call any api method, example:
api.searchListings(params, urlParams);

Reusable Features

Most api methods have a defined params or urlParams object as input.

params

A JavaScript object with property keys as defined parameters used as input for an API method.

urlParams

A JavaScript object with property keys as defined url parameters used to attach to the url of an endpoint.

get(url)

A JavaScript function of the EV API Wrapper that is reusable for get requests and adds the proper authorization headers.

post(url, data)

A JavaScript function of the EV API Wrapper that is reusable for post requests and adds the proper authorization headers.

addPagination

A JavaScript function of the EV API Wrapper that is reusable for requests that use standard pagination. It adds a helpful .next and .prev properties to nagivate via automated pagination.

addOffsetPagination

A JavaScript function of the EV API Wrapper that is reusable for requests that use offset and limit pagination. It adds a helpful .page, .next, and .prev properties to nagivate via automated pagination.

Methods

api.searchListings

  • Endpoint: /listings/search
  • Parameters: params, urlParams

api.listSavedSearches

  • Endpoint: /search
  • Parameters: userId, urlParams

api.saveSearch

  • Endpoint: /search/save/[userId]
  • Parameters: userId, searchData

api.deleteSavedSearch

  • Endpoint: /search/delete/[searchId]/[userId]
  • Parameters: userId, searchId

api.listFavoriteProperties

  • Endpoint: /favorites/[userId]
  • Parameters: sortDir, isCachedData, asArray

api.saveListing

  • Endpoint: /favorites/save/[userId]/[listingId]
  • Parameters: userId, listingId

api.deleteSavedListing

  • Endpoint: /favorites/delete/[favId]/[listingId]
  • Parameters: userId, listingId, favId

api.listingByShop

  • Endpoint: /listings/shop/[shop]
  • Parameters: shop, params

api.listingByAgent

  • Endpoint: /listings/agent/[agent]
  • Parameters: agent, params

api.propertyDetails

  • Endpoint: /listings/details/[path]
  • Parameters: path, params

api.listAdvisors

  • Endpoint: /advisors
  • Parameters: params

api.advisorDetails

  • Endpoint: /advisors/[id]
  • Parameters: id

api.advisorListings

  • Endpoint: /listings/agent/[agent]?[params]
  • Parameters: agent, params

api.locale

This returns the current locale of the page

api.convertCurrency

  • Endpoint: /currency-conversions?[params]
  • Parameters: params

api.smartConvertCurrency

  • Endpoint: /currency-conversions?baseCurrency=USD
  • Parameters: params

api.convertArea

This converts square feet to meters squared

  • Parameters: params

api.formatNumber

This formats any number to the correct locale

api.listShopsAtPlace

  • Endpoint: /places?[params]
  • Parameters: params

api.localLogicUsaNeighborhoodById

  • Endpoint: /neighborhoods/USA/id/[id]
  • Parameters: id

api.localLogicUsaNeighborhoodByLatLng

  • Endpoint: /neighborhoods/USA/geometry/[lat]/[lng]
  • Parameters: params

api.localLogicCanadaNeighborhoodById

  • Endpoint: /neighborhoods/Canada/id/[id]
  • Parameters: id

api.localLogicCanadaNeighborhoodByLatLng

  • Endpoint: /neighborhoods/Canada/geometry/[lat]/[lng]
  • Parameters: params

api.advisorBio

  • Endpoint: /advisors/[id]
  • Parameters: id

api.mlsCompList

  • No Specific Endpoint (Uses getClient.getEntries)

api.searchShops

  • Endpoint: /places?[params]
  • Parameters: params

api.marketInsightsDaysOfInventoryCount

  • Endpoint: /market-insights/days-of-inventory-count/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.marketInsightsInventoryCount

  • Endpoint: /market-insights/inventory-count/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.marketInsightsMedianDaysOnMarket

  • Endpoint: /market-insights/median-days-on-market/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.marketInsightsMedianListPriceDollars

  • Endpoint: /market-insights/median-list-price-dollars/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.marketInsightsPricePerSqFtDollars

  • Endpoint: /market-insights/price-per-sqft-dollars/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.marketInsightsSaleVsListPricePercent

  • Endpoint: /market-insights/sale-vs-list-price-percent/[zipcode]?[urlParams]
  • Parameters: zipcode, urlParams

api.localeDictionary

  • Endpoint: /config/language/[locale]
  • Parameters: locale