Bazaar — classifieds#
Every resource offers the standard set of actions
get, get-by, get-all, save, update-columns, delete, delete-all —
unless stated otherwise. See the CRUD pattern.
Resources#
| Resource | Note |
|---|---|
advert |
advert — owner, event |
advert-follower |
following |
advert-report |
reporting |
advert-statistics |
view statistics |
category |
category — tree, public |
parameter |
parameter — tree, public |
parameter-group |
parameter group |
parameter-rule |
display rule |
category-parameter-rel |
parameter targeting |
response |
reply to an advert — owner, receiver, event |
watchdog |
saved search — owner, event |
tariff |
tariff |
payment-item |
payment item |
🔴 An advert has no fixed fields#
Title, description and price are parameters, not columns
Writing an advert therefore does not send data[name] but parameter values.
Which parameters a category requires you learn from category-parameter-rel.
Reserved parameter keys: name, price, email, regionId.
Categories and parameters are trees#
Both. A select parameter's options are its children.
delete-node deletes the whole subtree
On a parameter, that includes all its options — and with them the values in every advert.
Advert visibility#
An advert is active only when it is approved, paid for, and not banned, deleted, deactivated or sold.
The active flag cannot be written
It is computed from those six. A write is rejected.
What a read returns#
An external caller without the administrator role gets from advert (get, get-by,
get-all, search) only the adverts the website shows: active and not expired
(expirationDate is today or later) — plus the signed-in user's own adverts
(insertUserId = the user from the token), even inactive or expired ones. From category it
gets only active categories.
| Caller | What it sees |
|---|---|
| guest (application key only) | active, unexpired adverts; active categories |
| signed-in user | the same + their own adverts in any state |
administrator (admin role) |
everything, unfiltered |
A hidden advert disappears without a trace
It is missing from a listing together with its relations (parameters, categories,
images, files, texts), and get of a hidden advert looks the same as a record that does
not exist. A listing page may therefore hold fewer records than limit, and totalCount
is only an upper bound — it subtracts only the hidden records of the returned page.
A reply to an advert#
The response resource distinguishes two sides:
| Side | Role | What they may do |
|---|---|---|
| the sender of the reply | owner |
edit and delete their own reply |
| the advert's owner | owner and receiver |
edit and delete a reply to their advert; get reads the detail; marks it as read (read) |
| the holder of the advert password | receiver |
the same as the owner, without signing in |
| an administrator | admin |
everything |
A reply has the database field readKey — a random secret key the site puts into the
Mark as read link in the email. The server sets it on creation and it is never written
from outside.
You do not get readKey over HTTP
Only the website inside the server knows the key. Nobody finds it in an API response — neither the receiver nor an administrator with a token.
Marking through the key has an internal path only
The action mark-read-by-key serves the site and has no HTTP wrapper. From an external
client you mark a reply only as the signed-in receiver, by writing the read column.
The price and currency of a reply (price, currencyId): the currency is required only with
a price and may only be a public monetary currency; a currency without a price is dropped. A
wrong write returns success: false, code: 2, see
API changes. The same
holds for company-directory replies.
A reply to a sold advert is refused: code: 607, data.errorCode: advertSold. A reply
whose e-mail, phone or IP address is on the blacklist returns code: 615, data.errorCode: blacklisted.
Writing an advert#
A non-privileged caller (guest, signed-in user, owner) is checked by the API the same way as
the website form. A refusal returns success: false, HTTP 200 and the reason in
data.errorCode — see Error codes.
| Check | code |
errorCode |
|---|---|---|
| a parameter value longer than its limit | 2 |
parameterTooLong |
| a link in a parameter that forbids links | 2 |
parameterUrlNotAllowed |
| an active forbidden word in the language of the request page | 2 |
parameterBlacklistedWord |
| a required parameter is missing according to the parameter rules | 2 |
parameterRequired |
| a choice option the form would not offer given the other values | 2 |
parameterOptionNotAllowed |
| the category is disabled (also through a disabled parent) or administrator-only | 615 |
advertCategoryNotAllowed |
| the e-mail or IP address of a new advert is on the blacklist | 615 |
blacklisted |
Required is driven by the parameter rules
A parameter may be required only under a condition — e.g. price and currency only for some
price types. Read the rules from parameter-rule. Required parameters are checked when a
new advert is inserted; uploads and hidden fields are not checked.
Images over the size limit#
A new image larger than the limit is not saved; the rest of the write passes. The response is
successful and lists the rejected files in saveInfo.rejectedUploads with the reason size:
{"success":true,"code":0,"message":"","data":{…},"saveInfo":{"rejectedUploads":[{"name":"photo.jpg","reason":"size"}]}}
Limit: max_size of the image upload parameter, else the site setting maxImageSize, else 50 MB.
Extending the expiry#
The extend-expiration action (advertId) in a paid category is refused for a
non-privileged caller: code: 607, data: null. An extension in a paid category is paid on
the website. The administrator extends for free.
Saved searches#
Require both a category and a region. They fire only when an advert is posted.
Price#
Prices in different currencies are not converted
Sorting by price mixes currencies. For comparable results, filter by currency.