PHP examples



Create seeker and customer in one request

sets up a customer and creates a new seeker with Draft status

        $url = "https://api.asariweb.pl/apiSite/createSeeker";

        $data = array (
        	userId                                  =>      <USER_ID>, // authentication userId
        	loginToken                              =>      '<LOGIN_TOKEN>', // authentication loginToken
        	'section'                               =>      'ApartmentSale',
        	'listingFilter.country.id'              =>      34,
        	'listingFilter.priceCurrency'           =>      'USD',
        	'listingFilter.priceMin'                =>      '400000',
        	'listingFilter.priceMax'                =>      '500000',
        	'listingFilter.totalAreaMin'            =>      '45',
        	'listingFilter.totalAreaMax'            =>      '55',
        	'seeker.description'                    =>      'Test description',
        	'customer.customerType'                 =>      'Person',
        	'customer.firstName'                    =>      'Jan',
        	'customer.lastName'                     =>      'Kowalski',
        	'email'                                 =>      'email@exaple.com',
        	'customer.phones[0].phoneNumber'        =>      '0123456789',
        	'customer.documentNo'                   =>      'ABC1234567',
        	'customer.address.city'                 =>      'Warsaw',
        	'customer.address.postalCode'           =>      '01-001',
        	'customer.address.street'               =>      'Sobieskiego',
			'customer.assignedTo.id'				=>		<USER_ID>,		// customer's agent
			'seeker.agent.id'						=>		<USER_ID>,		// seeker's agent
			'seeker.status'							=>		'Active'		// default 'Draft'
        );

        $data_string = http_build_query($data);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
		curl_close($ch); 

Listing list

	$url = "https://api.asariweb.pl/apiSite/exportedListingIdList";

    $input = array(
        userId                                  =>      <USER_ID>, // authentication userId
    	loginToken                              =>      '<LOGIN_TOKEN>', // authentication loginToken
    );

	$curl = curl_init();
	$userAgent = $_SERVER['HTTP_USER_AGENT'];
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
	curl_setopt($curl, CURLOPT_TIMEOUT, 30);
	curl_setopt($curl, CURLOPT_HEADER, 0);
	curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
	curl_setopt($curl, CURLOPT_POSTFIELDS, $input);
	curl_setopt($curl, CURLOPT_URL, $url);
	$result = curl_exec($curl);
	curl_close($curl);

Get listing

    $url = "https://api.asariweb.pl/apiSite/listing";

    $input = array( 
        userId                                  =>      <USER_ID>, // authentication userId
        loginToken                              =>      '<LOGIN_TOKEN>', // authentication loginToken
		id										=>		<ID_LISTING> // example: 51234524
	);

    $curl = curl_init();
    $userAgent = $_SERVER['HTTP_USER_AGENT'];
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($curl, CURLOPT_POSTFIELDS, $input);
    curl_setopt($curl, CURLOPT_URL, $url);
    $result = curl_exec($curl);
    curl_close($curl);