Listings - Admin

Create or update listing with smart Integrazu integration

Unified save endpoint that:

  1. IF listing_id is null: Creates new listing in ViaturasEasyDataGreen IF listing_id is provided: Updates existing listing
  2. IF brands with platforms are provided:
    • Checks existing Integrazu state
    • Decides whether to start a job or send direct update
  3. IF website_ids are provided:
    • Creates Z_WebsiteExports records

Decision Logic for Integrazu:

  • No advert exists -> Start job (create + photos + publish)
  • Advert exists + new platforms -> Start job (publish only)
  • Advert exists + all platforms synced -> Direct PUT update (no job)

Args: request_body: ListingSaveRequest with listing_id (optional), listing_data, brands, website_ids, image_urls

Returns: ListingSaveResponse with results per brand

post/api/listings/save

Headers

x-api-tokenstring nullable

Request body

listing_idinteger nullable

ViaturasEasyDataGreen.ID - if null, creates new listing

vehicle_idinteger nullable

Viatura.ID - used when creating new listing from vehicle

listing_dataobject required

Listing data matching ViaturasEasyDataGreen columns

website_idsinteger[] nullable

List of Websites.id to export listing to (Z_WebsiteExports)

image_urlsstring[] nullable

List of image URLs to upload to Integrazu

Response

Successful Response

listing_idinteger required
listing_savedboolean required
website_exports_createdinteger nullable
website_exports_removedinteger nullable

Example response

{
  "integrazu": {
    "brands": [
      {
        "action": "job_started",
        "brand_id": 5,
        "job_id": 123,
        "platforms_to_publish": [
          "carmine",
          "standvirtual"
        ],
        "reason": "no_advert_exists"
      },
      {
        "action": "update_sent",
        "brand_id": 8,
        "reason": "all_platforms_already_published"
      }
    ]
  },
  "listing_id": 925,
  "listing_saved": true,
  "website_exports_created": 2,
  "website_exports_removed": 1
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.