asariAPI
The data downloaded by API should be saved to a local database. Web pages should display data from database prepared in that way.
Number of queries to the API is restricted to 25 per minute (It's best to use a 3-4 second interval). Limit of connection can undergo change.
Introduction
Api methods serve http calls responding with json (http://www.json.org/). Methods for website creation are described in apiSite section.
Authentication via Token
To autheniticate you need id of user and unique token. loginToken and userId should be sent with other parameters of request. F.ex.
https://api.asariweb.pl/apiLocation/findLocations?query=Warszawa&userId=12456&loginToken=abcdefghij3131231231321
Parameter types
Parameter in method calls should be formated as following
Type | Format | Examples |
---|---|---|
integer | number | 123345 |
float | decimal part separated by comma or period | 123.4343 |
date | yyyy-MM-dd | 2010-12-31 |
string | text | bla bla bla |
boolean | true | |
dictionary | string value representing given dictionary value (listed below) | Active |
Pagination and sorting
Some methods returning list of objects allow pagination. Following paramterers should be applied (If no max(limit) provided system will automatically set parameter to reasonable value).
Parameter | Type | Description |
---|---|---|
offset | integer | return result starting from row (0 based) |
max | integer | max number of rows to return |
Sorting can be obtained by providng following parameters. Both parameters should be sent.
Parameter | Type | Description |
---|---|---|
sort | string | name of property |
order | string | 'asc' or 'desc' |
Response format
Every response object has property:
- success (boolean) - determaining if response is valid or error occured.
Success Response
Json object with properties:
- data (object or array of objects)
- totalCount (integer) - returned if data is array and method enables pagination
Example simple object:
{ success: true data: { id: 1 propertyType: "House" } }
Example list:
{ success: true, data: [ { id: 1, propertyType: "House"}, { id: 2, propertyType: "Lot"}, { id: 3, propertyType: "House"}, ], totalCount: 140 }
Error Response
Json object with properties:
- error (string) - error message in human readable format (localized)
- parametersErrors (object where properties are names of parameters and values are error messages related to given parameter) - returned if error is related to input parameters. F.ex. can be used as error messages for forms submitted by user.
Example error:
{ success: false, error: "You need to activate asariCRM to add tasks" }
Example error with parameter errors:
{ success: false, error: "Invalid input", parameterErrors : { email: "Invalid format", password: "Password to short" } }
Return types
Method will return json object with following properties (more info http://www.json.org/ )
Type | Format | Example |
---|---|---|
string | text | "bla bla bla" |
integer | number | 3242 |
float | decimal part separated by period | 3232.3232 |
date | text in format yyyy-MM-dd hh:mm:ss | "2010-12-31 18:55:58" |
boolean | true, false | |
money | object { amount: (float),currency:(string)} | { amount: 251 currency:"PLN"} |
Dictionaries
Name | Values |
---|---|
fieldType | string, integer, float, date, boolean, money, dictionary, dictionaryList |
view | show, edit, list, search |
section | ApartmentSale, ApartmentRental, HouseSale, HouseRental, LotSale, LotRental, CommercialSpaceSale, CommercialSpaceRental, CommercialObjectSale, CommercialObjectRental, WarehouseSale, WarehouseRental, Investment, RoomRental |
status | Active, Cancelled, Closed, Pending, Draft |
taskStatus | Waiting, Solved, Cancelled |
taskType | Regular, Reminder, Appointment |
listingActivityEventType | Appointment, ContactAcquisition, Email, Printout |
seekerActivityEventType | Appointment, ContactAcquisition, Email |
seekerPrivilege | Contact, PublicContact, Edit, Related |
listingPrivilege | Contact, PublicContact, Edit, Related |
contractType | Exclusive, Open, None, Direct, CustomerApplication |
ownershipType | Mortgage, HousingCooperative, Shared, Other |
currency | PLN, EUR, USD |
customerType | Person, Company |
customerFrom | Press, Internet, Phone, DirectVisit, Command |
commissionPercentPeriod | Year, Month |
valueType | String, Integer, Float, Date, Boolean, Dictionary, DictionaryList |
scope | All , Company, Swo, Office |
condition | Perfect, VeryGood, Good, NeedsSmallRenovation, NeedsTotalRenovation, NeedsConversion, NeedsFinishing, OpenRawState, CloseRawState |
Methods
- Required paremeters are marked with *
- If property is type of dictionary and both names are the same, name of dictionary is ommited f.ex. - sectionName(dictionary SectionName) -> sectionName(dictionary)
- Methods that raturn that don't return no data except of success indicator are marked as succces/failure