API Reference

The 999.md API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. JSON is returned by all API responses, including errors.

Payment info

Please note! Posting an ad via API costs 1 MDL

Authentication

Authenticate your account when using the API by including your secret API key in the request. You can manage your API key in the API Dashboard. Your API key carry many privileges, so be sure to keep it secret! Do not share your secret API key in publicly accessible areas such GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username value. You do not need to provide a password.

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Example request using cURL command-line tool:

curl https://partners-api.999.md/categories \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"

NOTE: cURL uses the -u flag to pass basic auth credentials (adding a colon after your API key prevents cURL from asking for a password).

Errors

999.md API uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the 5xx range indicate an error with 999.md API servers.

Backward compatibility

What changes are considered to be “backwards-compatible”?

  • Adding new API resources.

  • Adding new optional request parameters to existing API methods.

  • Adding new properties to existing API responses.

  • Changing the order of properties in existing API responses.

We notify all users about backwards-incompatible changes.

Localization & Translation

You can specify a language for entries using the lang parameter. The lang parameter must be the ISO 639-1 two-letter language code.

Supported language codes:

  • ru

  • ro

If you don’t specify a language, the default language ru is used.

Example request:

curl 'https://partners-api.999.md/categories?lang=ro' \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"

Pagination

Requests that return multiple items will be paginated to 30 items by default. You can specify further pages with the page parameter. You can also set a custom page size with the page_size parameter.

Example request:

curl 'https://partners-api.999.md/ads?page=2&page_size=50' \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"

Note that page numbering is 1-based and that omitting the page parameter will return the first page.

Images

API works with image identifiers. URLs of images could be generated by concatenation of URL prefix and image identifier:

URL prefix is: https://i.simpalsmedia.com/999.md/BoardImages/160x120/

So, for example, if image identifier is 12345678901234567890123456789000.jpg, then full image URLs will be:

Thumbnail-size image:

https://i.simpalsmedia.com/999.md/BoardImages/160x120/12345678901234567890123456789000.jpg

Full-size image: https://i.simpalsmedia.com/999.md/BoardImages/900x900/12345678901234567890123456789000.jpg

Categories

Categories list

GET https://partners-api.999.md/categories?lang=ru
Responses200
Headers
Content-Type: application/json
Body
{
  "categories": [
    {
      "id": "658",
      "title": "Транспорт",
      "url": "transport"
    },
    {
      "id": "270",
      "title": "Недвижимость",
      "url": "real-estate"
    }
  ]
}

Categories list
GET/categories{?lang}

Get a list of categories.

URI Parameters
HideShow
lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Subcategories

Subcategories list

GET https://partners-api.999.md/categories/658/subcategories?lang=ru
Responses200
Headers
Content-Type: application/json
Body
{
  "subcategories": [
    {
      "id": "659",
      "title": "Легковые автомобили",
      "url": "transport/cars"
    },
    {
      "id": "660",
      "title": "Автобусы и микроавтобусы",
      "url": "transport/buses-and-minibuses"
    }
  ]
}

Subcategories list
GET/categories/{category_id}/subcategories{?lang}

Get a list of subcategories.

URI Parameters
HideShow
category_id
integer (required) Example: 658

Category id (parent of subcategories)

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Subcategory offer types

Subcategory offer types list

GET https://partners-api.999.md/categories/658/subcategories/659/offer-types?lang=ru
Responses200
Headers
Content-Type: application/json
Body
{
  "offer_types": [
    {
      "id": "776",
      "title": "Продам"
    },
    {
      "id": "777",
      "title": "Куплю"
    },
    {
      "id": "778",
      "title": "Меняю"
    }
  ]
}

Subcategory offer types list
GET/categories/{category_id}/subcategories/{subcategory_id}/offer-types{?lang}

Get a list of subcategory offer types.

URI Parameters
HideShow
category_id
integer (required) Example: 658

Category id (parent of subcategory)

subcategory_id
integer (required) Example: 659

Subcategory id

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Phone numbers

User's phone numbers list

GET https://partners-api.999.md/phone_numbers?lang=ru
RequestsHTTP
Headers
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Responses200
Body
{
  "phone_numbers": [
    {
      "phone_number": "37378888888",
      "country_code": 373,
      "national_number": "78888888",
      "region": "Молдова"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "phone_numbers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "phone_number": {
            "type": "string",
            "description": "Phone number (in the international format)"
          },
          "country_code": {
            "type": "number",
            "description": "Country code part of the phone number"
          },
          "national_number": {
            "type": "string",
            "description": "National number part of the phone number"
          },
          "region": {
            "type": "string",
            "description": "Country name"
          }
        },
        "required": [
          "phone_number",
          "country_code",
          "national_number",
          "region"
        ]
      },
      "description": "Array of phone numbers"
    }
  },
  "required": [
    "phone_numbers"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

User's phone numbers list
GET/phone_numbers{?lang}

Get a list of verified phone numbers

URI Parameters
HideShow
lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Adverts

Advert states

Each advert has a state (state attribute).

States

  • public

    • Advert is public and available to all users.
  • blocked

    • Advert is blocked by administration. Block reasons are indicated in block_reasons attribute. Advert must be edited to become public.
  • blocked_commercial

    • Advert is blocked by administration for commercial reasons. It must be republished to become public.
  • need_pay

  • hidden

    • Advert has private access policy (hidden from all users except the owner). Advert access policy must be updated to become public.
  • expired

    • Advert active period has expired. It must be republished to become public.

Advert features

Each advert has a list of features with associated values.

Types of features

Each feature of advert has type. Type indicates the type of feature value.

  • textbox_text

    • type of value: string - short text (without newlines)

    • Example feature object:

      {
        "id": "782",
        "value": "Hello, world!"
      }
  • textarea_text

    • type of value: string - text (newlines are allowed).

    • Example feature object:

      {
        "id": "782",
        "value": "Hello,\n\nworld!"
      }
  • textbox_numeric

    • type of value: integer

    • Example feature object:

      {
        "id": "64",
        "value": 33
      }
  • textbox_numeric_measurement

    • type of value: integer

    • Unit of measurement is required (specified in the unit attribute).

      • Units associated with certain feature can be found in the units attribute of feature in the feature description
    • Example feature object:

      {
        "id": "2",
        "value": 100,
        "unit": "eur"
      }
  • check_box

    • type of value: boolean - indicates whether feature should be present in the advert or not

    • Example feature object:

      {
        "id": "78",
        "value": true
      }
  • drop_down_options

    • type of value: string - ID of an option

      • Options associated with certain feature can be found in the options attribute of a feature in the feature description
      • Some options depend on the value of another feature (these features have depends_on attribute != null).
    • Example feature object:

      {
        "id": "782",
        "value": "123"
      }
  • upload_images

    • type of value: array of strings - IDs of images. image_id is available after image upload.

    • Example feature object:

      {
        "id": "78",
        "value": [
          "c69825db15f7b43b882434fc2c9e0e8f.jpg?metadata=%7B%22image_type%22%3A+%22regular%22%2C+%22width%22%3A+1280%2C+%22signature%22%3A+%2289860ae9462208a8099af119fa656c04ba51b560%22%2C+%22metadata_version%22%3A+1%2C+%22height%22%3A+853%7D",
          "82b55030b1cb9009a72cb0698ca23f81.jpg?metadata=%7B%22image_type%22%3A+%22regular%22%2C+%22width%22%3A+960%2C+%22signature%22%3A+%22e985c046331f97424e6fa9cc9bdcb6fd1e2e4669%22%2C+%22metadata_version%22%3A+1%2C+%22height%22%3A+1280%7D"
        ]
      }
  • upload_videos

    • type of value: array of strings - video URLs

    • Example feature object:

      {
        "id": "78",
        "value": [
          "https://play.md/12345678",
          "https://www.youtube.com/watch?v=Ac1zJkhBzf8"
        ]
      }
  • contacts

    • type of value: array of strings - phone numbers

    • Example feature object:

      {
        "id": "78",
        "value": [
          "37378000000",
          "37361234567"
        ]
      }

Get features for creating a new advert

GET https://partners-api.999.md/features?category_id=658&subcategory_id=659&offer_type=776&lang=ru
Responses200
Body
{
  "features_groups": [
    {
      "title": "общее",
      "features": [
        {
          "id": "2",
          "title": "цена",
          "type": "textbox_numeric_measurement",
          "required": true,
          "units": [
            "eur",
            "usd",
            "mdl"
          ],
          "depends_on": null,
          "options": null
        }
      ]
    },
    {
      "title": "характеристики",
      "features": [
        {
          "id": "795",
          "title": "автор объявления",
          "type": "drop_down_options",
          "required": true,
          "units": null,
          "depends_on": null,
          "options": [
            {
              "id": "18894",
              "title": "Агентство"
            },
            {
              "id": "20364",
              "title": "Застройщик"
            },
            {
              "id": "18895",
              "title": "Частное лицо"
            }
          ]
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "features_groups": {
      "type": "array",
      "description": "List of groups of features"
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Title of the group of features"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "ID of the feature"
                },
                "title": {
                  "type": "string",
                  "description": "Title of the feature"
                },
                "type": {
                  "enum": [
                    "textbox_text",
                    "textarea_text",
                    "textbox_numeric",
                    "textbox_numeric_measurement",
                    "check_box",
                    "drop_down_options",
                    "upload_images",
                    "upload_videos",
                    "contacts"
                  ],
                  "description": "Type of the feature"
                },
                "required": {
                  "type": "boolean",
                  "description": "Boolean flag that indicates whether this feature is required in advert"
                },
                "units": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  },
                  "description": "List of allowed units of measurement of features of type `textbox_numeric_measurement`. `null` otherwise."
                },
                "depends_on": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "ID of the feature which is dependency of this feature options (see docs)"
                },
                "options": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "ID of the option"
                      },
                      "title": {
                        "type": "string",
                        "description": "Title of the option"
                      }
                    },
                    "required": [
                      "id",
                      "title"
                    ]
                  },
                  "description": "List of feature options of features of type `drop_down_options`. `null` otherwise."
                }
              },
              "required": [
                "id",
                "title",
                "type",
                "required",
                "units",
                "depends_on",
                "options"
              ]
            },
            "description": "List of features"
          }
        },
        "required": [
          "title",
          "features"
        ]
      }
    }
  },
  "required": [
    "features_groups"
  ]
}

Get features for creating a new advert
GET/features{?category_id,subcategory_id,offer_type,lang}

Get features for creating of new advert in specific category and for specific offer type.

Features of an advert depend on category, subcategory and offer type. You should obtain appropriate values of the following parameters:

URI Parameters
HideShow
category_id
integer (required) Example: 658

Category id (parent of subcategory)

subcategory_id
integer (required) Example: 659

Subcategory id

offer_type
integer (required) Example: 776

Subcategory offer type

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Get dependent options

GET https://partners-api.999.md/dependent_options?subcategory_id=659&dependency_feature_id=20&parent_option_id=34&lang=ru
Responses200
Body
{
  "options": [
    {
      "id": "223",
      "title": "1 Series"
    },
    {
      "id": "19269",
      "title": "2 Series"
    },
    {
      "id": "78",
      "value": "3 Series"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "options": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID of option"
          },
          "title": {
            "type": "string",
            "description": "Title of option"
          }
        },
        "required": [
          "id",
          "title"
        ]
      }
    }
  },
  "required": [
    "options"
  ]
}

Get dependent options
GET/dependent_options{?subcategory_id,dependency_feature_id,parent_option_id,lang}

Get options that depend on another selected option.

URI Parameters
HideShow
subcategory_id
integer (required) Example: 659

Subcategory ID

dependency_feature_id
integer (required) Example: 20

Feature ID of dependency (value of depends_on attribute)

parent_option_id
integer (required) Example: 34

Selected option ID of dependency

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Get advert

GET https://partners-api.999.md/adverts/12345678?lang=ru
Responses200
Body
{
  "id": "12345678",
  "categories": {
    "category": {
      "id": "658",
      "url": "transport",
      "title": "Транспорт"
    },
    "subcategory": {
      "id": "659",
      "url": "transport/cars",
      "title": "Легковые автомобили"
    }
  },
  "state": "public",
  "offer_type": {
    "title": "тип предложения",
    "value": "Продам"
  },
  "title": "Test title",
  "body": "Test body",
  "price": {
    "value": 1,
    "unit": "Hello, world!"
  },
  "features": [
    {
      "id": "2",
      "value": "100",
      "unit": "eur"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "ID of the advert"
    },
    "categories": {
      "type": "object",
      "properties": {
        "category": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "ID of category"
            },
            "url": {
              "type": "string",
              "description": "URL of category"
            },
            "title": {
              "type": "string",
              "description": "Title of category"
            }
          },
          "required": [
            "id",
            "url",
            "title"
          ]
        },
        "subcategory": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "ID of subcategory"
            },
            "url": {
              "type": "string",
              "description": "URL of category"
            },
            "title": {
              "type": "string",
              "description": "Title of category"
            }
          },
          "required": [
            "id",
            "url",
            "title"
          ]
        }
      }
    },
    "state": {
      "enum": [
        "public",
        "blocked",
        "blocked_commercial",
        "hidden",
        "expired",
        "need_pay"
      ],
      "description": "State of advert"
    },
    "offer_type": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "Offer type of advert"
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "title",
        "value"
      ]
    },
    "title": {
      "type": "string",
      "description": "Title of advert"
    },
    "body": {
      "type": [
        "string",
        "null"
      ],
      "description": "Body of advert"
    },
    "price": {
      "type": "object",
      "properties": {
        "value": {
          "type": "number"
        },
        "unit": {
          "type": "string"
        }
      },
      "required": [
        "value",
        "unit"
      ]
    },
    "features": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Advert feature id"
          },
          "value": {
            "type": "string",
            "description": "Advert feature value"
          },
          "unit": {
            "type": "string",
            "description": "Unit of a feature value (required only for features with `textbox_numeric_measurement` type)."
          }
        },
        "required": [
          "id",
          "value"
        ]
      }
    }
  },
  "required": [
    "id",
    "state",
    "title",
    "body",
    "features"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

Get advert
GET/adverts/{advert_id}{?lang}

Get data of existing advert.

URI Parameters
HideShow
advert_id
integer (required) Example: 12345678

Advert ID

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Get features of existing advert

GET https://partners-api.999.md/adverts/12345678/features?lang=ru
Responses200
Body
{
  "features_groups": [
    {
      "title": "общее",
      "features": [
        {
          "id": "2",
          "title": "цена",
          "type": "textbox_numeric_measurement",
          "required": true,
          "units": [
            "eur",
            "usd",
            "mdl"
          ],
          "depends_on": null,
          "options": null
        }
      ]
    },
    {
      "title": "характеристики",
      "features": [
        {
          "id": "795",
          "title": "автор объявления",
          "type": "drop_down_options",
          "required": true,
          "units": null,
          "depends_on": null,
          "options": [
            {
              "id": "18894",
              "title": "Агентство"
            },
            {
              "id": "20364",
              "title": "Застройщик"
            },
            {
              "id": "18895",
              "title": "Частное лицо"
            }
          ]
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "features_groups": {
      "type": "array",
      "description": "List of groups of features"
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Title of the group of features"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "ID of the feature"
                },
                "title": {
                  "type": "string",
                  "description": "Title of the feature"
                },
                "type": {
                  "enum": [
                    "textbox_text",
                    "textarea_text",
                    "textbox_numeric",
                    "textbox_numeric_measurement",
                    "check_box",
                    "drop_down_options",
                    "upload_images",
                    "upload_videos",
                    "contacts"
                  ],
                  "description": "Type of the feature"
                },
                "required": {
                  "type": "boolean",
                  "description": "Boolean flag that indicates whether this feature is required in advert"
                },
                "units": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "type": "string"
                  },
                  "description": "List of allowed units of measurement of features of type `textbox_numeric_measurement`. `null` otherwise"
                },
                "depends_on": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "ID of the feature which is dependency of option of this feature (see docs)"
                },
                "options": {
                  "type": [
                    "array",
                    "null"
                  ]
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "ID of the option"
                      },
                      "title": {
                        "type": "string",
                        "description": "Title of the option"
                      }
                    },
                    "required": [
                      "id",
                      "title"
                    ]
                  },
                  "description": "List of options of features of type `drop_down_options`. `null` otherwise."
                }
              },
              "required": [
                "id",
                "title",
                "type",
                "required",
                "units",
                "depends_on",
                "options"
              ]
            },
            "description": "List of features"
          }
        },
        "required": [
          "title",
          "features"
        ]
      }
    }
  },
  "required": [
    "features_groups"
  ]
}

Get features of existing advert
GET/adverts/{advert_id}/features{?lang}

Get features of existing advert.

URI Parameters
HideShow
advert_id
integer (required) Example: 12345678

Advert ID

lang
string (optional) Default: ru Example: ru

Language code for entries

Choices: ru ro


Add advert

POST https://partners-api.999.md/adverts
RequestsHTTPcURLPHP
Headers
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Body
{
  "category_id": "658",
  "subcategory_id": "1401",
  "offer_type": "18979",
  "features": [
    {"id": "2", "value": 100, "unit": "eur"},
    {"id": "5", "value": "12869"},
    {"id": "7", "value": "12900"},
    {"id": "12", "value": "test title"},
    {"id": "13", "value": "test description"},
    {"id": "16", "value": ["37378000000"]},
    {"id": "908", "value": true},
    {"id": "939", "value": true},
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "category_id": {
      "type": "string",
      "description": "Advert category id"
    },
    "subcategory_id": {
      "type": "string",
      "description": "Advert subcategory id"
    },
    "offer_type": {
      "type": "string",
      "description": "Advert offer type"
    },
    "features": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Advert feature id"
          },
          "value": {
            "type": [
              "string",
              "integer",
              "boolean",
              "array"
            ],
            "description": "Advert feature value"
          },
          "unit": {
            "type": "string",
            "description": "Unit of a feature value (required only for features with `textbox_numeric_measurement` type)."
          }
        },
        "required": [
          "id",
          "value"
        ]
      }
    }
  },
  "required": [
    "category_id",
    "subcategory_id",
    "offer_type",
    "features"
  ]
}
Responses201400
Headers
Content-Type: application/json
Body
{
  "advert": {
    "id": "1"
  }
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}
Body
curl https://partners-api.999.md/adverts \
    --request "POST" \
    --header "Content-Type: application/json" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:" \
    --data '{"category_id": "658", "subcategory_id": "659", "offer_type": "776", "features": [{"id": "2", "value": 100, "unit": "eur"}]}'
Responses201400
Headers
Content-Type: application/json
Body
{
  "advert": {
    "id": "1"
  }
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}
Body
<?php

$auth_key = '<auth_key>';
$http_basic_auth_credentials = $auth_key . ":";
$authorization_header = base64_encode($http_basic_auth_credentials);

$data = array(
    'category_id' => '658',
    'subcategory_id' => '1401',
    'offer_type' => '18979',
    'features' => array(
        array('id' => '2', 'value' => 100, 'unit' => 'eur'),
        array('id' => '5', 'value' => '12869'),
        array('id' => '7', 'value' => '12900'),
        array('id' => '12', 'value' => 'test title'),
        array('id' => '13', 'value' => 'test description'),
        array('id' => '16', 'value' => ['37370000000']),
        array('id' => '908', 'value' => true),
        array('id' => '939', 'value' => true),
    )
);

$options = array(
    'http' => array(
        'header'  => "Content-type: application/json\r\nAuthorization: Basic " . $authorization_header,
        'method'  => 'POST',
        'content' => json_encode($data)
    ),
);

$context = stream_context_create($options);
$response = file_get_contents('https://partners-api.999.md/adverts', false, $context);
$result = json_decode($response, TRUE);

?>
Responses201400
Headers
Content-Type: application/json
Body
{
  "advert": {
    "id": "1"
  }
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}

Add advert
POST/adverts

Post a new advert.

Advert object attributes

  • category_id (string, required)

  • subcategory_id (string, required)

  • offer_type (string, required)

  • features (array of objects, required)

    • Use Advert featrues resource to get available features of an advert in specific category, subcategory and for specific offer type

    • object attributes

      • id (string, required) - ID of the feature
      • value ([string, integer, boolean, array[string]], required) - Value of the feature
      • unit (string) - Unit of feature value (required only for features with textbox_numeric_measurement type).

Update advert

PATCH https://partners-api.999.md/adverts/123455678
RequestsHTTPcURL
Headers
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Body
{
  "features": [
    {
      "id": "2",
      "value": 100,
      "unit": "eur"
    },
    {
      "id": "16",
      "value": [
        "37378000000",
        "37361234567"
      ]
    },
    {
      "id": "123",
      "value": null
    }
  ],
  "offer_type": "777"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "features": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Advert feature id"
          },
          "value": {
            "type": [
              "null",
              "string",
              "integer",
              "boolean",
              "array"
            ],
            "description": "Advert feature value"
          },
          "unit": {
            "type": "string",
            "description": "Unit of a feature value (required only for features with `textbox_numeric_measurement` type)."
          }
        },
        "required": [
          "id",
          "value"
        ]
      }
    },
    "offer_type": {
      "type": "string",
      "description": "offer type of advert"
    }
  },
  "required": [
    "features"
  ]
}
Responses201400
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}
Body
curl https://partners-api.999.md/adverts/12345678 \
    --request "PATCH" \
    --header "Content-Type: application/json" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:" \
    --data '{"features": [{"id": "2", "value": 100, "unit": "eur"}]}'
Responses201400
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}

Update advert
PATCH/adverts/{advert_id}

Update an advert with partial JSON data.

Only features indicates in the request features array will be updated.
Advert features not specified in the request will not be updated.
To remove feature value from advert, indicate null as value.

For example, to update value of feature 111 and remove value of feature 123 from advert, use the following request:

{
  "features": [
    {
      "id": "111",
      "value": "test"
    },
    {
      "id": "123",
      "value": null
    }
  ]
}
URI Parameters
HideShow
advert_id
string (required) Example: 123455678

ID of advert


Get adverts

GET https://partners-api.999.md/adverts?page_size=5&page=2&lang=ru&states=public,hidden
RequestscURL
Body
curl https://partners-api.999.md/adverts?page_size=10&page=2&states=public,hidden \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"
Responses200
Body
{
  "adverts": [
    {
      "id": "12345678",
      "title": "Test title",
      "state": "public",
      "categories": {
        "category": {
          "id": "658",
          "title": "Транспорт",
          "url": "transport"
        },
        "subcategory": {
          "id": "659",
          "title": "Легковые автомобили",
          "url": "transport/cars"
        }
      },
      "type": "standard",
      "views_counter": 123,
      "autorepublisher": {
        "enabled": true,
        "from_hour": 8,
        "to_hour": 20,
        "interval": 0,
        "weekdays": [
          0
        ]
      },
      "posted": "2016-08-01T15:46:19+03:00",
      "republished": "2016-08-01T15:46:19+03:00",
      "expire": "2016-08-01T15:46:19+03:00",
      "block_reasons": [
        {
          "type": "illegal",
          "title": "Нарушение закона"
        }
      ]
    }
  ],
  "page_size": 5,
  "page": 2,
  "subtotal": 15,
  "total": 25
}
Schema
{
  "type": "object",
  "properties": {
    "adverts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Advert ID"
          },
          "title": {
            "type": "string",
            "description": "Advert title"
          },
          "state": {
            "enum": [
              "public",
              "blocked",
              "blocked_commercial",
              "need_pay",
              "hidden",
              "expired"
            ],
            "description": "State of advert"
          },
          "categories": {
            "type": "object",
            "properties": {
              "category": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "title",
                  "url"
                ],
                "description": "Advert category"
              },
              "subcategory": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "title",
                  "url"
                ],
                "description": "Advert subcategory info"
              }
            },
            "required": [
              "category",
              "subcategory"
            ]
          },
          "type": {
            "enum": [
              "standard",
              "colored"
            ],
            "description": "Type of advert"
          },
          "views_counter": {
            "type": "number",
            "description": "Counter of advert views"
          },
          "autorepublisher": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean",
                "description": "Turn autorepublisher on or off using this flag"
              },
              "from_hour": {
                "type": "number",
                "description": "Autorepublisher start hour"
              },
              "to_hour": {
                "type": "number",
                "description": "Autorepublisher stop hour"
              },
              "interval": {
                "enum": [
                  0,
                  30,
                  60,
                  120,
                  180,
                  240,
                  360,
                  480,
                  720,
                  1440
                ],
                "description": "Interval between republishing (in minutes)"
              },
              "weekdays": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "description": "Array of weekdays when autorepublisher should be active. Weekdays represented as integer numbers  (Monday - 0, Sunday - 6)"
              }
            },
            "required": [
              "enabled",
              "from_hour",
              "to_hour",
              "interval",
              "weekdays"
            ]
          },
          "posted": {
            "type": "string",
            "description": "Date of advert creation in ISO 8601 format"
          },
          "republished": {
            "type": "string",
            "description": "Date of the last (re-)publishing in ISO 8601 format"
          },
          "expire": {
            "type": "string",
            "description": "Date of advert expiration in ISO 8601 format"
          },
          "block_reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Type of block reason"
                },
                "title": {
                  "type": "string",
                  "description": "Title of block reason"
                }
              }
            }
          }
        },
        "required": [
          "id",
          "title",
          "state",
          "categories",
          "type",
          "views_counter",
          "autorepublisher",
          "posted",
          "republished",
          "expire",
          "block_reasons"
        ]
      }
    },
    "page_size": {
      "type": "number",
      "description": "Number of adverts per page"
    },
    "page": {
      "type": "number",
      "description": "Page number"
    },
    "subtotal": {
      "type": "number",
      "description": "Number of adverts in current result set (filtering by `state` attribute is taken into account)"
    },
    "total": {
      "type": "number",
      "description": "Number of adverts regardless of filtering"
    }
  },
  "required": [
    "adverts",
    "page_size",
    "page",
    "subtotal",
    "total"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

Get adverts
GET/adverts{?page_size,page,lang,states}

Get user’s adverts (only essential data).

Adverts are sorted by republished date (date of the last (re-)publishing) in descending order.

URI Parameters
HideShow
page_size
integer (optional) Default: 30 Example: 5

Number of adverts per page (For more information, see: pagination)

page
integer (optional) Default: 1 Example: 2

Page number (For more information, see: localization)

lang
string (optional) Default: ru Example: ru

Language code for entries (For more information, see pagination)

Choices: ru ro

states
string (optional) Example: public,hidden

Filter results by advert states (For more information, see advert states)

Default: public,blocked,blocked_commercial,need_pay,hidden,expired


Republish advert

POST https://partners-api.999.md/adverts/123456789/republish
RequestscURL
Body
curl https://partners-api.999.md/adverts/123456789/republish \
    --request "POST" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"
Responses200402
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "code": 402,
      "reason": "payment_required",
      "message": "Insufficient funds",
  }
}

Republish advert
POST/adverts/{advert_id}/republish

Republish an advert.

URI Parameters
HideShow
advert_id
string (required) Example: 123456789

Advert id


Color advert

POST https://partners-api.999.md/adverts/123456789/color
RequestscURL
Body
curl https://partners-api.999.md/adverts/123456789/color \
    --request "POST" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"
Responses200402
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "code": 402,
    "reason": "payment_required",
    "message": "Insufficient funds",
  }
}

Color advert
POST/adverts/{advert_id}/color

Color an advert.

URI Parameters
HideShow
advert_id
string (required) Example: 123456789

Advert id


Set advert access policy

PUT https://partners-api.999.md/adverts/123456789/access_policy
RequestsHTTPcURL
Headers
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Content-Type: application/json
Body
{
  "access_policy": "private"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "access_policy": {
      "type": "string",
      "enum": [
        "private",
        "public"
      ],
      "description": "Access policy (`private` will hide advert from other users)"
    }
  },
  "required": [
    "access_policy"
  ]
}
Responses200400
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}
Body
curl https://partners-api.999.md/adverts/123456789/access_policy \
    --request "PUT" \
    --header "Content-Type: application/json" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"
    --data '{"access_policy": "private"}'
Responses200400
Headers
Content-Type: application/json
Body
{
  "success": true
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}

Set advert access policy
PUT/adverts/{advert_id}/access_policy

URI Parameters
HideShow
advert_id
string (required) Example: 123456789

Advert id


Advert autorepublisher

GET https://partners-api.999.md/adverts/123456789/autorepublisher
Responses200
Headers
Content-Type: application/json
Body
{
  "enabled": true,
  "from_hour": 10,
  "to_hour": 20,
  "interval": 120,
  "weekdays": [
    0,
    1,
    5,
    6
  ],
  "info": {
    "daily_price": 5,
    "next_republish_date": "2017-06-24T13:00:47+03:00"
  }
}

Get advert autorepublisher settings
GET/adverts/{advert_id}/autorepublisher

URI Parameters
HideShow
advert_id
string (required) Example: 123456789

Advert id


PUT https://partners-api.999.md/adverts/123456789/autorepublisher
RequestsHTTP
Headers
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Body
{
  "enabled": true,
  "from_hour": 8,
  "to_hour": 20,
  "interval": 30,
  "weekdays": [
    0,
    1,
    2,
    3,
    4
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean",
      "description": "Turn autorepublisher on or off using this flag"
    },
    "from_hour": {
      "type": "number",
      "description": "Autorepublisher start hour"
    },
    "to_hour": {
      "type": "number",
      "description": "Autorepublisher stop hour"
    },
    "interval": {
      "enum": [
        30,
        60,
        120,
        180,
        240,
        360,
        480,
        720,
        1440
      ],
      "description": "Interval between republishing (in minutes)"
    },
    "weekdays": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "description": "Array of weekdays when autorepublisher should be active. Weekdays represented as integer numbers  (Monday - 0, Sunday - 6)"
    }
  },
  "required": [
    "enabled",
    "from_hour",
    "to_hour",
    "interval",
    "weekdays"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Responses200400
Headers
Content-Type: application/json
Body
{
  "success": true
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "description": "Success message"
    }
  },
  "required": [
    "success"
  ]
}
Headers
Content-Type: application/json
Body
{
  "error": {
    "message": ""
  }
}

Setup advert autorepublisher
PUT/adverts/{advert_id}/autorepublisher

URI Parameters
HideShow
advert_id
string (required) Example: 123456789

Advert id


Images

Upload image

POST https://partners-api.999.md/images
RequestsHTTPcURL
Headers
Content-Type: multipart/form-data; boundary=---BOUNDARY
Authorization: Basic Q3hZa0hXO1JvUnFIVHB0aFMyq927eE1VvHlYSzo=
Body
-----BOUNDARY
Content-Disposition: form-data; name="file"; filename="image.jpg"
Content-Type: image/jpeg

... contents of image.jpg ...
-----BOUNDARY
Responses200
Body
{
  "image_id": "b197ca31d0306af61da9d405b4fa8cf4.jpg?metadata=%7B%22image"
}
Schema
{
  "type": "object",
  "properties": {
    "image_id": {
      "type": "string",
      "description": "Image ID which should be used during adding or updating adverts"
    }
  },
  "required": [
    "image_id"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}
Body
curl https://partners-api.999.md/images \
    --request "POST" \
    --user "AxYcHhZsPqHTpthS2C_7xRmPoLK:"
    --form "file=@image.jpg"
Responses200
Body
{
  "image_id": "b197ca31d0306af61da9d405b4fa8cf4.jpg?metadata=%7B%22image"
}
Schema
{
  "type": "object",
  "properties": {
    "image_id": {
      "type": "string",
      "description": "Image ID which should be used during adding or updating adverts"
    }
  },
  "required": [
    "image_id"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

Upload image
POST/images

Use multipart/form-data HTTP request. Form must include field named file with image data.

Please note! You can upload up to 300 images per day.


Generated by aglio on 13 Jul 2018