99acre - Pull API

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

API Description:

API URL: https://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/


uid/

The My99 Queries and Responses can be pulled out using the data exchange xmls. User's
username and password are used to authenticate requests.

The request XML will be posted on our https API


URL https://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/uid/

In case of any error error xml will be returned.

Request xml, Response xml, Error xmland API doc shared with users are attached with this
page.

For sample code check 'How to Check on Live' section.

Tags Info

Request XML

The Request xml will contain client's username & password used to login on 99acres. It
should also contain a start date and end date only in format YY-MM-DD hh:mm:ss format,
the queries received on the site between these dates will be provided in the response xml in
the format described in the sample response xml.

1. user_name

2. pwd

3. start_date

4. end_date

Response XML

ActionStatus = true means success

1) Resp-- The main tag that would repeat for each response of Customer

This is divided into two subtags.

I)QryDtl -- Details wrt query received Attributes [TblId --For Internal Use ie we can track
with this our corresponding table entry; ResType -- S2M/LEAD/SIMPLE QUERY]

1)ProdId -- Product ID Attributes [Status-Product Status at our end ie


expired/screening/active etc; Type-- Product Type eg LP-B,PG,NP etc] 2)CmpctLabl --
Product Compact Description Label 3)QryInfo -- Query Text or Requirement Info in case of
Lead 4)RcvdOn -- Timestamp of query received
II)CntctDtl --- Contact details of buyer

1)Name 2)Email 3)Phone

ActionStatus = false means error

Error XML & Codes:

1) Code--Different Codes for error cases

2) Message-- Error Message

The error cases that we have identified till now are as:-

1) Authentication failure: Incorrect Username/Password?--- Error Code can be ERROR-0001

2) Incorrect Dates: Start Date too old---ERROR-0002

3) Incorrect Dates : Start Date and end Date difference greater---ERROR-0003

4) Page Limit Exceeded---ERROR-0004

5) End Date is lesser than start date--ERROR-0005

6) Invalid Date -Send valid dates in YYYY-MM-DD hh:mm:ss--ERROR-0005

* In case of 0 responses for customer the Resp tag would be empty with ActionStatus =
true

Restrictions:

1. There will be limit on the difference in start date & end dates between which data can be
pulled from My99 (2 days).

2. Start date cannot be older than 30 days from current date.

3. Date till which data has been pulled will be tracked at client side.

4. A response XMl can be of maximum 5000 responses.

On validating input data (token validation followed by username&password&dates) , the


my99response is generated.

Note:

1) There is no pagination provided.

2) Maximum number of request in an hour is 6


How to check on live:

Edit 99api/getmy99Response.xml and execute

https://www.99acres.com/99api/postData2.php?api=getmy99Response

PHP CODE:

<?php

$url = "https://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/uid/";
$request = "<?xml
version='1.0'?><query><user_name>XXXXX</user_name><pswd>YYYYYYY</pswd><start_date>2015-
05-22 00:00:00</start_date><end_date>2015-05-23 00:00:00</end_date></query>";
// echo $request;
$allParams = array('xml'=>$request);
$leads = get99AcresLeads($allParams,$url);
print_r($leads);

function get99AcresLeads($allParams,$url){
$crl = curl_init($url);
curl_setopt ($crl, CURLOPT_POST, 1);
curl_setopt ($crl, CURLOPT_POSTFIELDS, $allParams);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER,1);
return curl_exec ($crl);
}

Sample Code

using System.IO;
using System;
using System.Net;
using System.Text;
using System.Collections.Specialized;
class Program
{
static void Main()
{

using(WebClient client = new WebClient()) {

NameValueCollection vals = new NameValueCollection();


vals.Add("xml", "<?xml
version='1.0'?><query><user_name>ZZZZZZZZ</user_name><pswd>ZZZZZZZZ</
pswd><start_date>2013-05-2100:00:00</start_date><end_date>2013-05-22
00:00:00</end_date></query>");
var data =client.UploadValues( "http://www.99acres.com/99api/v1/getmy99Response/
OeAuXClO43hwseaXEQ/uid/", vals);
Console.WriteLine(data+ " Thank You! ");
string res = System.Text.Encoding.ASCII.GetString(data);
Console.WriteLine(":)"+res);
Console.ReadLine();
}
}
}

ERROR XML:

1 <?xml version="1.0"?>
2 <Xml ActionStatus = "false">
3 <ErrorDetail>
4 <Code>ERROR-123</Code>
5 <Message>Sorry the authentication does not succeed</Message>
6 </ErrorDetail>
7 </Xml>

Request XML:
1 <?xml version="1.0"?>
2 <query>
3 <user_name>Bob</user_name>
4 <pswd>[email protected] </pswd>
5 <start_date>2013-02-20 00:00:00</start_date>
6 <end_date>2013-02-20 00:00:00</end_date>
7 </query>

Response XML:

1 <?xml version="1.0"?>
2 <Xml ActionStatus = "true">
3 <Resp>
4 <QryDtl TblId='Q-1234' ResType='S2M'>
5 <ProdId Status='Active' Type='LP-B'>X3763167</ProdId>
6 <CmpctLabl>Residential apartment available on sale in aaa-9, noida for rs.5 crore</CmpctLabl>
7 <QryInfo>I am interested in this Property. first</QryInfo>
8 <RcvdOn>2013/02/20 11:24:00</RcvdOn>
9 </QryDtl>
10 <CntctDtl>
11 <Name>Priyanka</Name>
12 <Email>[email protected]</Email>
13 <Phone>8765456787</Phone>
14 </CntctDtl>
15 </Resp>
16 </Xml>

Updated Code:

1 <?php
2 $url = "http://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/uid/";
3 $request = "<?xml version='1.0'?><query><user_name>XXXXXX</user_name><pswd>YYYYY</pswd><start_date>20
4 $allParams = array('xml'=>$request);
5 $leads = get99AcresLeads($allParams,$url);
6 print_r($leads);
7
8
9
10 function get99AcresLeads($allParams,$url){
11 $crl = curl_init($url);
12 curl_setopt ($crl, CURLOPT_POST, 1);
13 curl_setopt ($crl, CURLOPT_POSTFIELDS, $allParams);
14 return curl_exec ($crl);
15 }

Get 99 response:
1 <?php
2
3 $url = "http://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/uid/";
4 $request = "<?xml version='1.0'?><query><user_name>XXXXXX</user_name><pswd>123456</pswd><star
5 // echo $request;
6 $allParams = array('xml'=>$request);
7 $leads = get99AcresLeads($allParams,$url);
8 print_r($leads);
9
10
11 function get99AcresLeads($allParams,$url){
12 $crl = curl_init($url);
13 curl_setopt ($crl, CURLOPT_POST, 1);
14 curl_setopt ($crl, CURLOPT_POSTFIELDS, $allParams);
15 curl_setopt ($crl, CURLOPT_RETURNTRANSFER,1);
16 return curl_exec ($crl);
17 }

You might also like