NAV Navbar
shell javascript

Introduction

This is the introduction of Top Agent Mo Apis. You can use these APIs to access Top Agents API endpoint.

Advertisements

Get All Advertisements

curl "https://api.topagentmo.com/api/advertisements"
const Http = new XMLHttpRequest();
const url='https://api.topagentmo.com/api/advertisements';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
  console.log(Http.responseText)
}

The above command returns JSON structured like this:

[{
    "_id": "5cdf979b16e67400178e10a9",
    "title": "https://topagentmo.com/download/",
    "imageUrl": "https://top-agent-macau.s3.amazonaws.com/advertisements/d33356779d24-4056-b0b0-dbe4ca099ed5.jpg",
    "createdAt": "2019-05-18T05:26:51.152Z",
    "updatedAt": "2019-05-28T06:28:33.099Z",
    "__v": 0,
    "link": "https://topagentmo.com/app-stores",
    "id": "5cdf979b16e67400178e10a9"
}, {
    "_id": "5cdf98bd16e67400178e10aa",
    "title": "6月28日到期",
    "imageUrl": "https://top-agent-macau.s3.amazonaws.com/advertisements/95bda86aa326-4863-b14c-1fbee5c0e90c.jpg",
    "createdAt": "2019-05-18T05:31:41.645Z",
    "updatedAt": "2019-05-21T01:57:13.264Z",
    "__v": 0,
    "id": "5cdf98bd16e67400178e10aa"
}]

This endpoint retrieves all top agent Advertisements images.

HTTP Request

https://api.topagentmo.com/api/advertisements

Building

Get Building infomation

curl "https://api.topagentmo.com/api/buildings/buildingName/海名居"
const Http = new XMLHttpRequest();
const url='https://api.topagentmo.com/api/buildings/layouts/海名居';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
  console.log(Http.responseText)
}

The above command returns JSON structured like this:

{
    "hasLayoutImages": true,
    "_id": "5b92057e5874ab26df6964f7",
    "name": "海名居",
    "district": "澳門 黑沙環",
    "address": "澳門東北大馬路",
    "numberOfBlock": "5",
    "numberOfUnit": "881",
    "contractor": "保利達集團",
    "developer": "",
    "dateCompletion": "2009-01-08",
    "dateOccupation": "",
    "pinYinName": "hai ming ju",
    "pinYinInfo": "hai ming ju  ao men  hei sha huan  ao men dong bei da ma lu 5 881 bao li da ji tuan 2009-01-08",
    "updatedAt": "2018-09-07T04:58:38.833Z",
    "createdAt": "2018-09-07T04:58:38.833Z",
    "__v": 0,
    "location": {
        "type": "Point",
        "coordinates": [113.55766971144588, 22.210277572771023]
    },
    "units": null,
    "id": "5b92057e5874ab26df6964f7"
}

This endpoint retrieves Building infomation.

HTTP Request

https://api.topagentmo.com/api/buildings/buildingName/:name

Advertise Properties

Get All Advertise Properties

curl "https://api.topagentmo.com/api/advertiseProperties"
const Http = new XMLHttpRequest();
const url='https://api.topagentmo.com/api/advertiseProperties';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
  console.log(Http.responseText)
}

The above command returns JSON structured like this:

[
    {
        "_id": "5ce79ae216e67400178e155e",
        "status": "forSell",
        "rentCondition": "吉租",
        "rentingPrice": 0,
        "sellPrice": 488,
        "rentPrice": 0,
        "property": {
            "_id": "5ce79ade16e67400178e155d",
            "bedroom": 2,
            "livingroom": 1,
            "bathroom": 1,
            "terrace": 0,
            "multiFunctionalRoom": 0,
            "compass": "unknown",
            "buildingName": "威苑",
            "district": "台山",
            "block": "A",
            "floor": "低層",
            "unit": "S",
            "grossArea": 649,
            "netArea": 0,
            "areaRate": 0,
            "view": "開揚",
            "decoration": "企理",
            "__v": 0,
            "description": "台山 威苑花園 銀行估足 首期98萬\nA座中層 649呎 正2房 21年樓 \n簡裝 租約至6/2019  荀售 488萬\n歡迎🈴️作62355129吳生"
        },
        "rentingUntil": "2019-05-24T07:18:54.758Z",
        "modifiedAt": "2019-05-24T07:20:04.507Z",
        "userId": "5cc0044043dace00174b5e02",
        "createdAt": "2019-05-24T07:18:58.427Z",
        "updatedAt": "2019-05-24T07:20:04.508Z",
        "__v": 0,
        "images": [
            {
                "_id": "5ce79b2216e67400178e155f",
                "property": "5ce79ade16e67400178e155d",
                "width": 854,
                "height": 640,
                "url": "top-agent-macau.s3.amazonaws.com/propertyImages/5cc0044043dace00174b5e02/2e1e9ff2b275-4c8e-93bc-d7d5e602a342.jpg",
                "userId": "5cc0044043dace00174b5e02",
                "createdAt": "2019-05-24T07:20:02.478Z",
                "updatedAt": "2019-05-24T07:20:02.478Z",
                "__v": 0
            },
            {
                "_id": "5ce79b2216e67400178e1560",
                "property": "5ce79ade16e67400178e155d",
                "width": 854,
                "height": 640,
                "url": "top-agent-macau.s3.amazonaws.com/propertyImages/5cc0044043dace00174b5e02/142b130bfebe-4c54-b45d-ce8a5f69197c.jpg",
                "userId": "5cc0044043dace00174b5e02",
                "createdAt": "2019-05-24T07:20:02.487Z",
                "updatedAt": "2019-05-24T07:20:02.487Z",
                "__v": 0
            },
            {
                "_id": "5ce79b2216e67400178e1561",
                "property": "5ce79ade16e67400178e155d",
                "width": 854,
                "height": 640,
                "url": "top-agent-macau.s3.amazonaws.com/propertyImages/5cc0044043dace00174b5e02/1f44b4ba9636-45f7-9182-ffd01a442463.jpg",
                "userId": "5cc0044043dace00174b5e02",
                "createdAt": "2019-05-24T07:20:02.501Z",
                "updatedAt": "2019-05-24T07:20:02.501Z",
                "__v": 0
            },
            {
                "_id": "5ce79b2216e67400178e1562",
                "property": "5ce79ade16e67400178e155d",
                "width": 854,
                "height": 640,
                "url": "top-agent-macau.s3.amazonaws.com/propertyImages/5cc0044043dace00174b5e02/836975bac34f-4ee3-97b2-5b291101dd93.jpg",
                "userId": "5cc0044043dace00174b5e02",
                "createdAt": "2019-05-24T07:20:02.507Z",
                "updatedAt": "2019-05-24T07:20:02.507Z",
                "__v": 0
            },
            {
                "_id": "5ce79b2216e67400178e1563",
                "property": "5ce79ade16e67400178e155d",
                "width": 640,
                "height": 854,
                "url": "top-agent-macau.s3.amazonaws.com/propertyImages/5cc0044043dace00174b5e02/ccfb1241034b-489a-a5e0-87dccc373061.jpg",
                "userId": "5cc0044043dace00174b5e02",
                "createdAt": "2019-05-24T07:20:02.514Z",
                "updatedAt": "2019-05-24T07:20:02.514Z",
                "__v": 0
            }
        ],
        "agent": {
            "_id": "5cc0048ce503f100173ca5b0",
            "name": "Bill",
            "phoneNumber": "62355129",
            "agentCode": "AI-10008306-2",
            "__v": 0
        },
        "id": "5ce79ae216e67400178e155e"
    }]

This endpoint retrieves all Advertise Properties. You can also use query parameter to filter advertise properties. This API support pagination/

HTTP Request

GET https://api.topagentmo.com/api/advertiseProperties

Query Parameters

Parameter Default Required Type Description
buildingName "" false String the search keyword of advertise properties
lowPrice 0 false Int the lower bound price range of the selling or renting
highPrice Math.INT false Int the upper bound price range of the selling or renting
lowBedroom 0 false Int the lower bound of number of bedroom
highBedroom Math.INT false Int the upper bound of number of bedroom
lowGrossArea 0 false Int the lower bound of property gross area
highGrossArea Math.INT false Int the upper bound of property gross area
compass all posible values false Array compass could contains “unknown”,”north”,”northEast”,”east”,”southEast”,”south”,”southWest”,”west”,”northWest”
status all false Int status could be ‘forSell’ or ‘forRent’. The status of these properties
page 0 false Int the page results of all advertise properties

Building Layouts

Get All Building Layouts

curl "https://api.topagentmo.com/api/buildings/layouts"
const Http = new XMLHttpRequest();
const url='https://api.topagentmo.com/api/buildings/layouts';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
  console.log(Http.responseText)
}

The above command returns JSON structured like this:

[
    {
        "hasLayoutImages": true,
        "_id": "5b92056a5874ab26df69626c",
        "name": "澳地豪庭",
        "district": "澳門 南灣",
        "address": "林茂海邊大馬路M地段",
        "numberOfBlock": "",
        "numberOfUnit": "",
        "contractor": "",
        "developer": "",
        "dateCompletion": "",
        "dateOccupation": "",
        "pinYinName": "ao di hao ting",
        "pinYinInfo": "ao di hao ting  ao men  nan wan  lin mao hai bian da ma lu M di duan",
        "updatedAt": "2018-09-07T04:58:18.429Z",
        "createdAt": "2018-09-07T04:58:18.429Z",
        "__v": 0,
        "location": {
            "type": "Point",
            "coordinates": [
                113.54156555979057,
                22.204287845299348
            ]
        },
        "units": null,
        "id": "5b92056a5874ab26df69626c"
    },
    {
        "hasLayoutImages": true,
        "_id": "5b92056a5874ab26df69626d",
        "name": "晉海",
        "district": "澳門 黑沙環",
        "address": "澳門",
        "numberOfBlock": "2",
        "numberOfUnit": "496",
        "contractor": "",
        "developer": "施美蘭集團",
        "dateCompletion": "",
        "dateOccupation": "",
        "pinYinName": "jin hai",
        "pinYinInfo": "jin hai  ao men  hei sha huan  ao men 2 496 shi mei lan ji tuan",
        "updatedAt": "2018-09-07T04:58:18.448Z",
        "createdAt": "2018-09-07T04:58:18.448Z",
        "__v": 0,
        "location": {
            "type": "Point",
            "coordinates": [
                113.55754138103217,
                22.2046099
            ]
        },
        "units": null,
        "id": "5b92056a5874ab26df69626d"
    }]

This endpoint retrieves all Buildings which have layout images.

HTTP Request

GET https://api.topagentmo.com/api/buildings/layouts

GET Building Layout Cover Image

curl "https://s3-ap-southeast-1.amazonaws.com/top-agent-macau-building-layouts/海名居/海名居.jpg"
const Http = new XMLHttpRequest();
const url='https://s3-ap-southeast-1.amazonaws.com/top-agent-macau-building-layouts/海名居/海名居.jpg';
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
  console.log(Http.responseText)
}

This above command returns one image data

To get the cover image, We use AWS S3 API with buildings name. Remember use only the result from Building Layout API.

GET https://s3-ap-southeast-1.amazonaws.com/top-agent-macau-building-layouts/{buildingName}/{buildingName}.jpg

GET Building Layouts

Building Layouts Images can be retrieve from AWS S3

To get the layouts images, We use AWS S3 API with buildings name. Remember use only the result from Building Layout API.

All the layout images are under fold with same file name as the building name. Please use S3 APIs to retreive the images under the folder. And use the S3 API to load the image

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.