PHP Examples (API SITE)
1. Overview
This guide explains how to integrate your system with the AsariCRM API to synchronize listings and images effectively, following a clear, structured, and developer‑friendly approach.
⚠️ Important:
Our API has a request rate limit — we recommend making each API call at intervals of approximately 3 seconds.
⚠️ Important:
When creating the script, pay attention to the status code — if it is other than 200, wait and retry the request.
2. Introduction
Start the integration by calling the exportedListingIdList method to retrieve the list of exported listings.
By default, the exportedListingIdList method returns listings with the Active status that are marked for website export in AsariCRM.
Store the returned data in your local database. For each listing, store at least the listing ID id and the last update timestamp lastUpdated.
During each synchronization, call the exportedListingIdList method again and compare the returned data with the data stored in your local database. Based on the comparison:
Remove listings that exist in your local database but are no longer returned by the method.
Add listings that are returned by the method but do not exist in your local database.
Update listings whose
lastUpdateupdate timestamp has changed.
Retrieve the details of each listing using the Listing method.
3. Authentication
The
SiteAuthheader (UserId and TOKEN) are generated upon request sent to dok@asaricrm.com from the email address of the service owner’s AsariCRM account.Be sure the email used matches the owner’s email as recorded in AsariCRM.
4. Returns a list of exported listing IDs.
<?php
$url = "https://api.asari.pro/site/exportedListingIdList";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('SiteAuth:UserId:TOKEN'));
$result = curl_exec($curl);
print_r($result);
$resultCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$resultCode .= ' RESPONSE CODE: ' . curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);
?>
5. Retrieve Listing Details
<?php
$url = "https://api.asari.pro/site/listing?id=listing_id";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('SiteAuth:UserId:TOKEN'));
$result = curl_exec($curl);
print_r($result);
$resultCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$resultCode .= ' RESPONSE CODE: ' . curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
curl_close($curl);
?>
6. Download Listing Images
https://img.asariweb.pl/normal/[image_id] Use the
imageIdfrom the listing response.
⚠️ Important:
Download images to your server. Do not hotlink to Asari domains.