Making Your First API Call

Preview

This lesson assumes you have never made a RESTful API call, ever. Not even once.

The IDX Broker API will NOT pass property details, search against the MLS data or property details by MLS ID. Nor can you download the raw MLS data. The ONLY exception is the featured listings (listings belong to the agent(s) on the account).

If you have experience with API calls you can can probably move on, however giving this lesson a once over is recommended.

This lesson is a sort of an abridged version of the API Docs found here: http://middleware.idxbroker.com/docs/api/overview.php

What is an API and RESTful?

An API is a software intermediary that makes it possible for application programs to interact with each other and share data. RESTful is an API structure based on using just a few verbs to describe how the API is used. For IDX Broker this means the following:

  • GET – Retrieves from the database
  • PUT – Add new data to the database
  • POST – Modify data already in the database
  • DELETE – Remove data from the database

Not all API endpoints will offer all four of these. Calls also should be stored and not called on every page load. This may be a database you set up or even just a .txt file.

There is a limit to the number of calls per hour. 500 for Platinum and 300 for Lite. API call budgeting is key.

Authentication?

IDX Broker uses API keys for authentication. These are passed via the request headers. Headers are information passed during online interactions. More on headers in a later lesson. API keys are available in every active IDX Broker account.

Passing this can vary by scripting language. For these lessons we will be using PHP. Other language examples are available on this unofficial GitHub repository.

Using the example code

IDX Broker provides example PHP using cURL to access the API. All API calls must be made using https. If your hosting environment does not support https you will not be able to make the API call. We will be calling this server side so you will need to host the php file on local or on live hosting someplace. Let’s call listcomponents. This is just a list of components available in the API. Components are like categories and are used to give structure to an API. Here is the code:
Copy and paste the above code in to your hosting (local or live) and replace the API key on line 10 with the API key from your IDX Broker account. Then save. On your local environment run the file or on live visit the url of the file. The file will call via cURL and the IDX Broker API and return the system links which the script has been told to print on the screen. In this case we have specified json as the format to return. You should get a json return :  

From here you would store the response in your database for later use. If you are unfamiliar with json you can specify xml. If you are unfamiliar on working with either, there are many resources available online to help you begin working with these formats.

Ok we have connected to the API, now what? You can explore the many other types of data available. Changing the endpoint (on line 4 in the code above) will return differing data. All available endpoints are listed in our official API docs.

 

There are and will be more lessons on using the IDX Broker API. Leads, Featured Listings, Saved Links, and more. Now that you have completed this really quick “hello world” type of lesson, check out the other API lessons and sample projects available. All examples are PHP so learning some basic PHP first if you are not that comfortable in that language is recommended.

 

Key Points:

  • The IDX Broker API will NOT pass property details, queries against the MLS data or property details by MLS ID
  • All API calls must use https
  • Budget your API calls

 

 

Back to: IDX Broker API > Connecting to the API

Data Services Provided By IDX, LLC
Content © 2024 IDX, LLC,
All Rights Reserved.