Publishing an investment and units

Publishing an Investment

To check the available attributes for the investments category (urn:concept:investments), you can use the Taxonomy API. Filter by site and category as in the example below to get only the results you need:

/taxonomy/v1/categories/partner/urn:site:storiaro/urn:concept:investments

*Payload example
You can use the example below to test it out (you can also find it on our API Reference or check Advert payload):

📘

Reminder

Each Portal has its own specifications, you need to make sure that you have the correct attributes for the target site.

{
    "title": "[qatest-mercury] Anunț test - olx",
    "description": "Uneori trebuie să adăugăm o astfel de reclamă pentru a verifica funcționarea unor funcții ale sistemului. Contăm pe înțelegerea dvs. :) Vă sfătuim să folosiți din nou căutătorul nostru de oferte. <br/> <br/> Noroc în căutarea dvs. ulterioară!",
    "category_urn": "urn:concept:investments",
    "market": "primary",
    "contact": {
        "name": "Bartek Kowalski",
        "phone": "663774007",
        "email": "[email protected]",
        "photo": "https://i.imgur.com/9Em2tky.png"
    },
    "price": {
        "value": 450000,
        "currency": "RON"
    },
    "location": {
        "lat": 47.22329888685773,
        "lon": 24.49607849121094,
        "exact": true
    },
    "images": [
        {
            "url": "https://i.imgur.com/WozSfdQg.jpg"
        },
        {
            "url": "https://i.imgur.com/3YNg1bI.jpg"
        }
    ],
    "movie_url": "https://www.youtube.com/watch?v=2me2WO6C1J8",
    "attributes": [
        {
            "urn": "urn:concept:status",
            "value": "urn:concept:in-building"
        },
        {
            "urn": "urn:concept:start-date",
            "value": "2020-06-01"
        },
        {
            "urn": "urn:concept:end-date",
            "value": "2021-06-01"
        },
        {
            "urn": "urn:concept:area-from",
            "value": "110"
        },
        {
            "urn": "urn:concept:area-to",
            "value": "510"
        },
        {
            "urn": "urn:concept:price-from",
            "value": "11000"
        },
        {
            "urn": "urn:concept:price-per-sq-meter-from",
            "value": "5"
        },
        {
            "urn": "urn:concept:number-of-floors",
            "value": "10"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:cellar"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:pool"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:terraces"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:elevator"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:closed-area"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:garage"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:security"
        },
        {
            "urn": "urn:concept:extras",
            "value": "urn:concept:garden"
        },
        {
            "urn": "urn:concept:estate-types",
            "value": "urn:concept:houses"
        },
        {
            "urn": "urn:concept:gross-area-m2",
            "value": "urn:concept:30000"
        },
        {
            "urn": "urn:concept:number-of-rooms",
            "value": "urn:concept:3"
        }
    ],
    "site_urn": "urn:site:storiaro",
    "custom_fields": {
        "id": "1121",
        "reference_id": "TEST1234"
    },
    "auto_extend": true
}

With the payload saved in advert.json, you need to follow the same request as to publish a normal advert.

curl -X POST \
-H "Content-type: application/json" \
-H "Accept: application/json" \
-H "User-Agent: crm_name"
-H "Authorization: Bearer <ACCESS TOKEN>"
-H "X-API-KEY: <YOUR API KEY>" \
-d @advert.json \
https://api.olxgroup.com/advert/v1/

After sending us the request, your CRM should wait for the notification of success before sending us the adverts per each unit that the client wants to publish.

Also, you should make sure to implement the logic to save the investment UUID and to associate it with the adverts of each unit.

Great, you're almost there!

Adding unit adverts to the investment

Now, your CRM can publish adverts that belong to investments. Those adverts are exactly the same as "normal" adverts. With a slight difference.

In order to associate adverts to investments, there's one extra field required in the advert payloadparent_uuid. This field should hold the UUID of the parent advert (the investment advert) which was previously posted with success.

Your CRM should implement logic that keeps the association between investments and units.

Follow an example of a payload of a unit advert associated with the investment previously created:

{
    "title": "[qatest-mercury] Anunț test - olx",
    "description": "Uneori trebuie să adăugăm o astfel de reclamă pentru a verifica funcționarea unor funcții ale sistemului. Contăm pe înțelegerea dvs. :) Vă sfătuim să folosiți din nou căutătorul nostru de oferte. <br/> <br/> Noroc în căutarea dvs. ulterioară!",
    "category_urn": "urn:concept:apartments-for-sale",
    "parent_uuid": "ad1119f3-bd89-4b41-82b1-bd6f3c6883f5",
    "market": "primary",
    "contact": {
        "name": "Bartek Kowalski",
        "phone": "663774007",
        "email": "[email protected]",
        "photo": "https://i.imgur.com/9Em2tky.png"
    },
    "price": {
        "value": 450000,
        "currency": "RON"
    },
    "location": {
        "lat": 47.22329888685773,
        "lon": 24.49607849121094,
        "exact": true
    },
    "images": [
        {
            "url": "https://i.imgur.com/WozSfdQg.jpg",
            "order": 1
        },
        {
            "url": "https://i.imgur.com/3YNg1bI.jpg",
            "order": 2
        }
    ],
    "attributes": [
        {
            "urn": "urn:concept:price-negotiable",
            "value": "urn:concept:yes"
        },
        {
            "urn": "urn:concept:number-of-rooms",
            "value": "urn:concept:4"
        },
        {
            "urn": "urn:concept:accepts-exchange",
            "value": "urn:concept:yes"
        },
        {
            "urn": "urn:concept:terrain-type",
            "value": "urn:concept:industrial"
        },
        {
            "urn": "urn:concept:slope",
            "value": "urn:concept:elevated-over-30"
        },
        {
            "urn": "urn:concept:price-per-sq-meter",
            "value": "urn:concept:30"
        },
        {
            "urn": "urn:concept:location",
            "value": "urn:concept:near-transport"
        },
        {
            "urn": "urn:concept:location",
            "value": "urn:concept:near-food-leisure"
        },
        {
            "urn": "urn:concept:location",
            "value": "urn:concept:near-green-area"
        },
        {
            "urn": "urn:concept:location",
            "value": "urn:concept:near-school"
        },
        {
            "urn": "urn:concept:location",
            "value": "urn:concept:near-commerce"
        }
    ],
    "site_urn": "urn:site:storiaro",
    "custom_fields": {
        "id": "in02",
        "reference_id": "TEST123698"
    },
    "auto_extend": true
}

If you add the unit advert without the "parent_uuid" field (as a Developer), you will receive the following error message:

{
    "data": {
        "data": {
            "detail": "Only Agency accounts can add standalone/regular ads.",
            "title": "ForbiddenException"
        },
        "destination": "your_webhook_url",
        "error_message": "Only Agency accounts can add standalone/regular ads.",
        "event_timestamp": 1714049666542,
        "event_type": "advert_posted_error",
        "flow": "publish_advert",
        "object_id": "1dd16ba3-47d9-4b93-b242-155bfb22d2c3",
        "timestamp": 1714049666542,
        "transaction_id": "af3fb1da-35d9-4dc5-9b4d-b2d9b7af4bd3"
    }
}

Removing unit adverts from the investment

There are two ways to remove (deactivate or delete) Investments Units:

    1. Remove the Unit individually. This can be by deleting or deactivating the unit advert;
    1. Remove the Investment advert, which will automatically remove all unit adverts, related to the "parent" advert. This automatic process will generate a lifecycle notification as explained here, for all affected unit adverts.

Deactivate and Activate investment adverts

This process is the same as described in Deactivate and Activate adverts, with a slight difference. Once the Investment is Deactivated or Activated, all units status will be automatically updated. And, for both scenarios, you will receive a lifecycle notification that the unit changed its status to "removed_by_parent_ad".