Where to learn how to use APIs?

Hi everyone,

I’m after a good resource to learn how to use APIs please? I kind of know you need JavaScript or PHP to parse the information… I have no idea where to start for learning how to use an API or anything, really I’m just looking for a solid starting point.

APIs differ. They may be SOAP, REST, JSON …
i.e. how they are accessed and what they return differ.

IMHO the best way to learn is by doing. Is there an API you’re interested in using?
If not I think JSON might be the easiest to start with (can be used by JavaScript as opposed to SOAP and REST which return XML)

Interesting, I’m planning on using this - http://www.realestateview.com.au/docs/rev_api/

With some data feed details and agent authority access information.

I just don’t know where to start with this. I need 4 pages to display data from property searches (for sale, for rent, leased and sold).

Edit: I guess I should take a step back and ask, do I need to learn PHP to be able to achieve this?

Maybe not PHP, in particular, but you will need to parse XML - which PHP can do nicely (many other languages can as well) **

2.2 XML Response - Resonse to ‘search’ or ‘view’ requests.

You may be able to insert the XML into the DOM and style it with JavaScript,

Do you have a live host server or a localhost server yet?

You’re comfortable with HTML, CSS and JavaScript but know no PHP?

EDIT
** I hadn’t seen
A.4 Search for listings (JSON)
under
Appendix A. Example XML Files

Try this in your browser (no server required , no PHP, HTML and JavaScript only)

<!DOCTYPE HTML>
<html lang="en">
<head>
<title>API test</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<style type="text/css">
</style>
<script type="text/javascript">
// this would be returned using XHR 
var realestateview_json = {
   "Pagination" : [
      {
         "PageURL" : "",
         "PageNumber" : "1"
      }
   ],
   "Listings" : [
      {
         "CityStateText" : "New South Wales",
         "SaleLeaseAlertPriceText" : "Expressions of Interest",
         "ListingResultsCount" : "1",
         "ContactAgentOfficePhone" : [
            "9727 8822",
            "02 9727 6077"
         ],
         "CarportsCount" : "3",
         "SaleLeaseAlertText" : "For Sale",
         "AgentsGroupNameSuburbLink" : "http://www.realestateview.com.au/agents/raine+and+horne+r+and+h+cabramatta",
         "AuctionTime" : "12:00AM",
         "StreetType" : "St",
         "AvailableOnlyFlag" : "1",
         "LandSize" : "916.00",
         "TotalParkingCount" : "6",
         "PropertyTypeText" : "House",
         "ContactAgentMobilePhone" : [
            "0414 982 978"
         ],
         "ClientAddress" : "5 Arthur St",
         "SaleLeaseTypeText" : "for Sale",
         "GroupID" : "123",
         "ClientSuburb" : "CABRAMATTA",
         "PropertyType" : [
            "House"
         ],
         "PriceText" : "Expressions of Interest",
         "ClientID" : "7373",
         "ForSale" : "1",
         "BedroomsCount" : "9",
         "PortalSection" : "buy",
         "FullDisplayLink" : "http://www.realestateview.com.au/Real-Estate/cabramatta/Property-Details-buy-residential-3328445.html",
         "PhotosCount" : "10",
         "GroupFontColor" : "000000",
         "PortalView" : "residential",
         "ClientState" : "NSW",
         "SaleLeaseText" : "Expressions of Interest",
         "OrderID" : "3328445",
         "Title" : "Rare Investment Opportunity!",
         "IsResidential" : "1",
         "GeocodeStatus" : "1",
         "Suburb" : "CABRAMATTA",
         "ContactAgentName" : [
            "Raine  Horne Cabramatta",
            "Peter Ly"
         ],
         "GroupFont" : "arial",
         "ClientLogoResultsURL" : "http://www.realestateview.com.au/logos/results/Raine-and-Horne-2.gif",
         "CityState" : "NSW",
         "ClientPostCode" : "2166",
         "PhotoFloorPlanUpdate" : "2011-11-23 18:28:08",
         "BathroomsCount" : "3",
         "ViewFullDisplayAltTag" : "View full details for  Cabramatta NSW 2166",
         "ClientLogoAltText" : "R&amp;H - Cabramatta",
         "ContactAgentEmail" : [
            "cabramatta@rh.com.au",
            "peter.ly@rh.com.au"
         ],
         "ClientName" : "R&amp;H Cabramatta",
         "HostName" : "www.realestateview.com.au",
         "LandSizeText" : "916",
         "LockUpGaragesCount" : "3",
         "FirstPropertyTypeOnly" : "House",
         "GroupBackgroundColor" : "FFCC00",
         "PostCode" : "2166",
         "PhotoThumbURL" : [
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-10-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-2-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-3-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-4-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-5-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-6-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-7-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-8-3328445.jpg",
            "http://images.revlocal.com.au/pics/445/Cabramatta-NSW-2166-Property-photo-9-3328445.jpg"
         ],
         "StreetNumber" : "2A",
         "StreetName" : "Levuka",
         "Description" : "3 units in one dwelling. All have separate entries and:\n*3 bedrooms, separate lounge and dining\n*Kitchen and bathroom\n*Single lock-up garage + car space\n\n*Ideal for investment/to live and collect income\n*Walk to Cabramatta school, station and shops\n*Current gross income of $46,000 p.a.\n*Ideal for 3 families"
      }
   ],
   "Search" : 1,
   "ResponseStatus" : "OK",
   "TotalMatching" : "1",
   "SearchNumber" : "190232266"
};
var city_state = realestateview_json.Listings[0].CityStateText;
</script>
</head>
<body>
<h1>API test</h1>
<div id="test_div"></div>
<script type="text/javascript">
// now that the DOM is loaded
var display_div = document.getElementById("test_div");
display_div.textContent = city_state;
</script>
</body>
</html>

I have a live host. http://www.dbelldesign.com.au/steveway/html5

Fine with HTML and CSS, learning JavaScript and PHP through SP Premium. PHP seems easier than JavaScript. I’m taking my time learning these but am struggling a bit.

This I put here - http://www.dbelldesign.com.au/steveway/html5/rev.html

Shows API test and New South Wales.

The current site they use iframes for the searches, I’m trying to update this so that it just shows results for sold, for sale, leased and for rent. Not to mention iframes are bad and I’m trying to make this mobile responsive.

Another site the agent sent me to look at which would do the job fine is http://www.mpcmoss.com.au/.

From what I gather this uses Drupal and possibly php for the results.

Any more ideas please?

Sorry for the delay, the weekend happened.

Have you had a chance to look at PHP’s CURL, and XML fiunctions? Still think PHP would be the easier?

http://php.net/manual/en/ref.curl.php
http://php.net/manual/en/book.simplexml.php
http://php.net/manual/en/book.xmlreader.php
http://php.net/manual/en/book.xml.php

If XML looks too daunting maybe JSON instead?
http://php.net/manual/en/ref.json.php

Also I’m not sure about

Do you know what those are in what the API returns?
I don’t see them explicitly so I’m guessing one or more of the numeric vales in combination represent the status.

Haha that’s all good, I understand. Hope you had a good one.

Honestly I’m not 100 percent sure how I would go about this as I have never done it before. The code involved behind the current search has Javascript in it, and uses a few different codes to differentiate sales and rentals. See this:

view-source:http://www.realestateview.com.au/cgi-bin/results.pl?BS=10&CS=VIC&Thu=on&GID=117&CID=0&Con=S&tp=dev%2F117&PTr=a&PTr=c&PTr=r&IKW=&Sub=&SurrSub=on&PrL=0&PrH=99999&Order=listed&PropertyID=

I do not know what they are in the API. I have the agent authority access details and feed details. I do not know how to use these. I think I will email the API support.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.