Integración de Inventario

Para más información soporte@chileautos.cl

Obtención de Token

Es necesario proveer el token dentro de cada solicitud realizada hacia la Global Inventory API.



    curl --location --request POST 'https://id.s.core.csnglobal.net/connect/token' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'client_id=464f4235-8052-4832-a5ea-6738021263fe' \
    --data-urlencode 'client_secret=Cen/5ic8fYtGbHMD4lU8VYHZ5/sJsU/N4qrl9V2DIzU=' \
    --data-urlencode 'grant_type=client_credentials'

    fetch('https://id.s.core.csnglobal.net/connect/token', {
    method: 'POST',
    body: new URLSearchParams({
    'client_id': '464f4235-8052-4832-a5ea-6738021263fe',
    'client_secret': 'Cen/5ic8fYtGbHMD4lU8VYHZ5/sJsU/N4qrl9V2DIzU=',
    'grant_type': 'client_credentials'
    }),
    headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    },
    }).then(response => response.json())
    .then(data => {
    console.log('Success:', data);
    })

    using System;
    using System.Net.Http;
    ...

    async static void GetToken()
    {
    HttpClient client = new HttpClient();
    client.BaseAddress = new Uri("https://id.s.core.csnglobal.net/connect/token");
    var request = new HttpRequestMessage(HttpMethod.Post, "");

    var keyValues = new List<KeyValuePair<string, string>>();
    keyValues.Add(new KeyValuePair<string, string>("client_id", "464f4235-8052-4832-a5ea-6738021263fe"));
    keyValues.Add(new KeyValuePair<string, string>("client_secret", "Cen/5ic8fYtGbHMD4lU8VYHZ5/sJsU/N4qrl9V2DIzU="));
    keyValues.Add(new KeyValuePair<string, string>("grant_type", "client_credentials"));

    request.Content = new FormUrlEncodedContent(keyValues);
    var response = await client.SendAsync(request);

    string result = response.Content.ReadAsStringAsync().Result;
    Console.WriteLine(result);

    }

    $client = new GuzzleHttp\Client();

    $response = $client->request('POST', 'https://id.s.core.csnglobal.net/connect/token', [
    'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded'
    ],
    'form_params' => [
    'client_id' => '464f4235-8052-4832-a5ea-6738021263fe',
    'client_secret' => 'Cen/5ic8fYtGbHMD4lU8VYHZ5/sJsU/N4qrl9V2DIzU=',
    'grant_type' => 'client_credentials',
    ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Credenciales

Clientid: 464f4235-8052-4832-a5ea-6738021263fe

Secret Key: Cen/5ic8fYtGbHMD4lU8VYHZ5/sJsU/N4qrl9V2DIzU=


{
    "Seller": {
        "Identifier": " 05e8ed1b-1355-4486-a6a2-a043959edff9"
    },
},

Este Identificador debe ser utilizado en el nodo Seller al momento de gestionar el inventario.

Nombre: Automotora / Concesionaria de prueba

Id: CL-SELLER-1344


Estas credenciales son solo para efecto de pruebas. Para obtener credenciales productivas debe contactar soporte@chileautos.cl

El token de acceso de este resultado debe ser usado para todas las solicitudes.


Envío de Inventario

Hemos disponibilizado un servicio que permite la administración del inventario. Con el mismo endpoint es posible publicar y actualizar avisos dentro de nuestro portal.

A continuación, encontraran un ejemplo completo de cómo se debe enviar un vehículo (auto para este caso) a publicar:




    curl --location --request POST 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "PublishingDestinations": [
        {
            "Name": ""
        }
    ],
    "Media": {
        "Photos": [
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_0.jpg",
                "Order": "1"
            },
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_1.jpg",
                "Order": "2"
            },
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_2.jpg",
                "Order": "3"
            }
        ]
    },
    "Seller": {
        "Identifier": "05e8ed1b-1355-4486-a6a2-a043959edff9"
    },
    "Specification": {
        "RecordType": "Autos, camionetas y 4x4",
        "Make": "Volkswagen",
        "Model": "Polo",
        "ReleaseDate": {
            "Year": 2019
        },
        "Title": "VOLKSWAGEN POLO 2019 DESING SOUND 1.6L L4 105HP TM",
        "ShortTitle": "VOLKSWAGEN POLO 2019",
        "Attributes": [
            {
                "Name": "Color",
                "Group": "Detalles",
                "DisplayName": "Color",
                "Value": "Blanco",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "DoorNumber",
                "Group": "Detalles",
                "DisplayName": "Puertas",
                "Value": "4",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "BodyStyle",
                "Group": "Detalles",
                "Value": "SUV",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "FuelType",
                "Group": "Detalles",
                "Value": "Gas",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "GearType",
                "Group": "Detalles",
                "Value": "Autom\u00e1tica",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoVehiculo",
                "Group": "Detalles",
                "DisplayName": "Tipo Vehiculo",
                "Value": "Autos, Camionetas y 4x4",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoCategoria",
                "Group": "Detalles",
                "DisplayName": "Tipo Categoria",
                "Value": "Camioneta",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Aire Acondicionado",
                "Group": "Equipamiento",
                "DisplayName": "Aire Acondicionado",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Espejos Electricos",
                "Group": "Equipamiento",
                "DisplayName": "Espejos Electricos",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Frenos ABS",
                "Group": "Equipamiento",
                "DisplayName": "Frenos ABS",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Airbag",
                "Group": "Equipamiento",
                "DisplayName": "Airbag",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Cierre Centralizado",
                "Group": "Equipamiento",
                "DisplayName": "Cierre Centralizado",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Catalítico",
                "Group": "Equipamiento",
                "DisplayName": "Catalítico",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Llantas",
                "Group": "Equipamiento",
                "DisplayName": "Llantas",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Alarma",
                "Group": "Equipamiento",
                "DisplayName": "Alarma",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Radio",
                "Group": "Equipamiento",
                "DisplayName": "Radio",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Cilindrada",
                "Group": "Equipamiento",
                "DisplayName": "Cilindrada",
                "Value": "1500",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            }
        ]
    },
    "Identifier": "55253bcc-b1f1-4c43-9c68-70669f6c2076",
    "Type": "Car",
    "ListingType": "Usado",
    "SaleStatus": "In Stock",
   "Registration": {
     "Number": "ABCD12"
    },
    "Description": "",
    
    "ExtendedProperties": [
        {
        "Name": "WhatsApp",
            "Value": "+56990432865"
        }
    ],
    
    "Colours": [
        {
        "Location": "Exterior",
            "Generic": "Grey",
            "Name": "Gris"
        },
        {
        "Location": "Interior",
            "Generic": "Grey",
            "Name": "Gris"
        }
    ],
    "OdometerReadings": [
        {
        "Value": 21968,
            "UnitOfMeasure": "KM"
        }
    ],
    "PriceList": [
        {
        "Currency": "CLP",
        "Amount": 224700
        }
    ]
}'

fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', {
    method: 'POST',
    body: {
    "PublishingDestinations": [
        {
            "Name": ""
        }
    ],
    "Media": {
        "Photos": [
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_0.jpg",
                "Order": "1"
            },
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_1.jpg",
                "Order": "2"
            },
            {
                "Url": "http://fotos.autos.cl/view/img/usedcars/hex99889/5fa300797e5ae/big/big_2.jpg",
                "Order": "3"
            }
        ]
    },
    "Seller": {
        "Identifier": "05e8ed1b-1355-4486-a6a2-a043959edff9"
    },
    "Specification": {
        "RecordType": "Autos, camionetas y 4x4",
        "Make": "Volkswagen",
        "Model": "Polo",
        "ReleaseDate": {
            "Year": 2019
        },
        "Title": "VOLKSWAGEN POLO 2019 DESING SOUND 1.6L L4 105HP TM",
        "ShortTitle": "VOLKSWAGEN POLO 2019",
        "Attributes": [
            {
                "Name": "Color",
                "Group": "Detalles",
                "DisplayName": "Color",
                "Value": "Blanco",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "DoorNumber",
                "Group": "Detalles",
                "DisplayName": "Puertas",
                "Value": "4",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "BodyStyle",
                "Group": "Detalles",
                "Value": "SUV",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "FuelType",
                "Group": "Detalles",
                "Value": "Gas",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "GearType",
                "Group": "Detalles",
                "Value": "Autom\u00e1tica",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoVehiculo",
                "Group": "Detalles",
                "DisplayName": "Tipo Vehiculo",
                "Value": "Autos, Camionetas y 4x4",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoCategoria",
                "Group": "Detalles",
                "DisplayName": "Tipo Categoria",
                "Value": "Camioneta",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Aire Acondicionado",
                "Group": "Equipamiento",
                "DisplayName": "Aire Acondicionado",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Espejos Electricos",
                "Group": "Equipamiento",
                "DisplayName": "Espejos Electricos",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Frenos ABS",
                "Group": "Equipamiento",
                "DisplayName": "Frenos ABS",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Airbag",
                "Group": "Equipamiento",
                "DisplayName": "Airbag",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Cierre Centralizado",
                "Group": "Equipamiento",
                "DisplayName": "Cierre Centralizado",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Catalítico",
                "Group": "Equipamiento",
                "DisplayName": "Catalítico",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Llantas",
                "Group": "Equipamiento",
                "DisplayName": "Llantas",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Alarma",
                "Group": "Equipamiento",
                "DisplayName": "Alarma",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Radio",
                "Group": "Equipamiento",
                "DisplayName": "Radio",
                "Value": "SI",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "Cilindrada",
                "Group": "Equipamiento",
                "DisplayName": "Cilindrada",
                "Value": "1500",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            }
        ]
    },
    "Identifier": "55253bcc-b1f1-4c43-9c68-70669f6c2076",
    "Type": "Car",
    "ListingType": "Usado",
    "SaleStatus": "In Stock",
    "Registration": {
        "Number": "ABCD12"
    },
    "Description": "",
    
    "ExtendedProperties": [
        {
        "Name": "WhatsApp",
            "Value": "+56990432865"
        }
    ],
    
    "Colours": [
        {
        "Location": "Exterior",
            "Generic": "Grey",
            "Name": "Gris"
        },
        {
        "Location": "Interior",
            "Generic": "Grey",
            "Name": "Gris"
        }
    ],
    "OdometerReadings": [
        {
        "Value": 21968,
            "UnitOfMeasure": "KM"
        }
    ],
    "PriceList": [
        {
        "Currency": "CLP",
         "Amount": 224700
        }
    ]
},
 headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {access_token}'
    }
}).then(response => response.json())
.then(data => {
    console.log('Success:', data);
})

using System;
using System.Net.Http;
using Newtonsoft.Json;
...

async static void CreateVehicle()
{

    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    var vehicle = new Vehicle("property1", "property2", ...);

    var json = JsonConvert.SerializeObject(vehicle);
    var data = new StringContent(json, Encoding.UTF8, "application/json");

    var uri = "http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}";

    var response = await client.PostAsync(uri);

    string result = response.Content.ReadAsStringAsync().Result;
    Console.WriteLine(result);
}

    $client = new GuzzleHttp\Client();

    $response = $client->request('POST', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Authorization' => 'Bearer {access_token}'
        ],
        'body' => [
            'Identifier' => '6C705713-52E6-447B-9FC2-C3C155EF41D0',
            'Type' => 'CAR',
            'ListingType' => 'USADO',
            'SaleStatus' => 'In Stock',
            'Description' => 'This is just a comment',
            'Key' => 'Value',
            'Key' => 'Value',
            ...
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

InventoryIdentifier es un valor de tipo GUID que debe ser generado por el usuario. Dicho identifier debe ser el mismo que va en el objeto de envío, en el campo Identifier.
Seller Identifier representa el valor para una sucursal. Para obtener un valor productivo debe contactar soporte@chileautos.cl
Registration.Number ó Patente es obligatoria en los avisos correspondientes a la categoría Autos, camionetas y 4x4. Asegúrese de enviar un valor con un formato válido de acuerdo a la normativa de Chile, e incluya todas las letras de la patente en mayúsculas. Ejemplo: XXXX00

"Registration":{
    "Number":"GLDX45"
}


La API actualmente nos permite publicar vehículos asociados a las categorías

  • Autos,Camionetas y 4x4
  • Motos
  • Camiones

Para diferenciar cada categoría solo deben ajustar los valores en los atributos Recordtype y Type, así como los Attributes necesarios dentro de las Specifications. A continuación, mostramos ejemplos para cada categoría:

Autos

En en ejemplo de envío de inventario pueden ver todos los atributos necesarios para publicar un auto.


{
    "Specification": {
    "RecordType": "Autos, camionetas y 4x4"     
    },
    "Type": "Car"
}

Motos


{
    "Specification":{
    "RecordType":"Motos",
    "Make":"Ducati",
    "Model":"Multistrada",
    "ReleaseDate":{
        "Year":2020
    },
    "Title":"DUCATI Multistrada 950 S",
    "ShortTitle":"DUCATI Multistrada 950 S",
    "Attributes": [
        {
            "DisplayName": "Color",
            "Group": "Detalles",
            "Name": "Color",
            "Value": "Azul",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        },
        {
            "Group": "Detalles",
            "Name": "BodyStyle",
            "Value": "Sport calle - urbanas",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        },
        {
            "Group": "Detalles",
            "Name": "FuelType",
            "Value": "Bencina",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        },
        {
            "Group": "Detalles",
            "Name": "GenericGearType",
            "Value": "Manual",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        },
        {
            "DisplayName": "Cilindrada",
            "Group": "Equipamiento",
            "Name": "Cilindrada",
            "Value": "1800",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        },
        {
            "DisplayName": "Tipo Vehiculo",
            "Group": "Detalles",
            "Name": "TipoVehiculo",
            "Value": "Tour",
            "DisplayOnDetailsPage": true,
            "IsKeyAttribute": false,
            "IsDeleted": false
        }
    ]
    },
    "Identifier":"3596889a-7f54-41d0-8716-97acf57ca332",
    "Type":"Bike",
}

Camiones


{
    "Specification": {
    "RecordType": "Camiones",
    "Make": "Maxus",
    "Model": "V80",
    "ReleaseDate": {
        "Year": 2023
    },
    "Title": "2023 Maxus V80",
    "ShortTitle": "2023 Maxus V80",
    "Attributes": [
        {
                "Name": "Color",
                "Group": "Detalles",
                "DisplayName": "Color",
                "Value": "Blanco",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "DoorNumber",
                "Group": "Detalles",
                "DisplayName": "Puertas",
                "Value": "2",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "BodyStyle",
                "Group": "Detalles",
                "Value": "Camión",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "FuelType",
                "Group": "Detalles",
                "Value": "Diesel",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "GearType",
                "Group": "Detalles",
                "Value": "Manual",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoVehiculo",
                "Group": "Detalles",
                "DisplayName": "Tipo Vehiculo",
                "Value": "Camión",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
            {
                "Name": "TipoCategoria",
                "Group": "Detalles",
                "DisplayName": "Tipo Categoria",
                "Value": "Camiones",
                "DisplayOnDetailsPage": true,
                "IsKeyAttribute": false,
                "IsDeleted": false
            },
    ]
    },
    "Identifier": "b4d888b6-5046-4e85-b6d9-98cc859fdc20",
    "Type": "TRUCK",
}


Media

Es posible agregar videos a los avisos, para ello solo debes agregar al nodo Media la siguiente información:


"Videos": [
	{
		"Url": "https://myexample.com/file.mp4",
		"Order": 1
	}
]

Los videos deben cumplir con las siguientes especificaciones:

  • Duración: Máximo 60 segundos ó 100 Mb
  • Formato: MP4 ó MOV

Precios (PriceList)

Es posible configurar el precio de un aviso tanto en moneda local (CLP) o en moneda extranjera (USD).

Los precios mÍnimos son CLP 100.000 y USD 1.000

Ejemplo:

Moneda Local

"PriceList": [
    {
      "Currency": "CLP",
      "Amount": 224700
    }
]


Moneda extranjera (USD)

"PriceList": [
    {
      "Currency": "USD",
      "Amount": 430000.0
    }
]


Productos

Es posible agregar productos desde la API, para eso solo debes incluir los tags correspondientes.
Para Chileautos, los productos disponbiles son los siguientes:

  • Premium
  • TopSpot o posición Top
  • Showcase o vitrina
  • Vehículo Certificado
  • Precio con Bono
  • Sale (DescuentosOnline) Producto de uso limitado que aplica descuento para ventas especiales

Existen productos con renovación mensual automática (recurrentes) y productos de un solo uso (one shot)

Para diferenciar el tipo de productos es necesario utilizar la propiedad Value del objeto Tag, como se indica en los siguientes ejemplos.

"Tags": [
    {
        "Name": "premium",
        "Value": "oneshot" // Para oneshot
    },
    {
        "Name": "premium" // Producto reutilizable solo disponible para Premium
    },
    {
        "Name": "topspot",
        "Value": "oneshot" // Para oneshot
    },
    {
        "Name": "topspot",
        "Value": "recurrente" // Para producto con renovación mensual
    },
    {
        "Name": "showcase",
        "Value": "oneshot" // Para oneshot"
    },
    {
        "Name": "showcase",
        "Value": "recurrente" // Para producto con renovación mensual
    },
    {
        "Name": "certified.ads",
        "Value": "oneshot" // Para oneshot
    },
{
        "Name": "certified.ads",
        "Value": "recurrente" // Para producto con renovación mensual
    },
    {
        "Name": "fb-price-tag",
        "Value": "oneshot" // Para oneshot
    },
    {
        "Name": "fb-price-tag",
        "Value": "recurrente" // Para producto con renovación mensual
    },
    {
        "Name": "descuentosonline",
        "Value": "oneshot" // Solo esta opción está disponible para este producto
    }
]

Para el caso del producto Sale (Descuentos Online) es necesario enviar en la lista de precios tanto el precio original como el precio rebajado. El monto mínimo de la rebaja debe ser equivalente al 10%, como se muestra en el siguiente ejemplo, todos los datos son obligatorios y el precio de rebaja debe ir en primer lugar.

"PriceList": [
    {
        "Type": "Sale",
        "Currency": "CLP",
        "Amount": 27000000
    },
    {
        "Type": "WAS",
        "Currency": "CLP",
        "Amount": 30000000
    },
]

Es importante cumplir con el formato antes señalado, de lo contrario la API responderá con un mensaje de error y el vehículo no será publicado.

Solo se podrán agregar productos contratados y vigentes, para consultar la disponibilidad de los productos deben usar el siguiente endpoint:



    curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/customers/{seller_identifier}/products' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''

    fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/customers/{seller_identifier}/products', {
    method: 'GET',
    headers: {
    'Authorization': 'Bearer {access_token}'
    'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
    console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/customers/{seller_identifier}/products';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/customers/{seller_identifier}/products', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

El response de este endpoint nos entrega los detalles de los productos disponibles para el cliente:


  {
    "name": "TopSpot", // Nombre del Producto
    "code": "TopSpot", // Código que debo utilizar para agregarlo al aviso
    "quantity": 20, // Cantidad total de productos contratados
    "lastUpdated": "02/14/2025 16:52:51",
    "available": 12,  // Cantidad disponible de productos para utilizar
    "countryCode": "CL",
    "type": "Secondary",
    "vertical": null,
    "isRecurrent": true, // Indica si el producto es recurrente
    "isOneshot": false // Indica si el producto es One Shot
  },
  {
    "name": "Premium",
    "code": "Premium",
    "quantity": 30,
    "lastUpdated": "02/14/2025 16:00:51",
    "available": 18,
    "countryCode": "CL",
    "type": "Primary",
    "vertical": null,
    "isRecurrent": false,
    "isOneshot": true
  }

En el ejemplo anterior tenemos los productos TopSpot Recurrente (isRecurrent = true) y Premium One Shot (inOneShot = true)

Estos productos solo se pueden asignar a los avisos si tienen la disponibilidad suficiente.
Además solamente se puede enviar un mismo producto por aviso oneShot o recurrente, por ejemplo si envía el tag showcase no puede agregar el tag showcase recurrente o viceversa dentro del mismo vehículo a publicar.
Asegúrese de contratar los mismos antes de enviar la información a la API, de lo contrario recibira un error como respuesta.

WhastApp

Es posible agregar este producto a un aviso a través del nodo ExtendedProperties al momento de publicar. Se debe tener en cuenta la siguiente estructura del número telefónico:

  • Prefijo país: +56
  • Prefijo operadora: 9
  • Nro asignado: 1111111

Ejemplo:


"ExtendedProperties": [
        {
            "Name": "WhatsApp",
            "Value": "+56990432865"
        }
    ]

Estos productos solo se pueden asignar a los avisos si tienen la disponibilidad suficiente. Asegúrese de contratar los mismos antes de enviar la información a la API, de lo contrario recibirá un error como respuesta.

Atributos

Para los atributos o especificaciones la información debe ser enviada de esta forma


{
    "Name": "Airbag",
    "Group": "Equipamiento",
    "DisplayName": "Airbag",
    "Value": "SI",
    "DisplayOnDetailsPage": true,
    "IsKeyAttribute": false,
    "IsDeleted": false
}


Tomen en cuenta que el campo Group le permite agrupar caracteristicas del vehículo, y eso se verá reflejado en el sitio de la siguiente forma

Actualización del Aviso

Existe un endpoint que permite actualizar algo específico del aviso sin necesidad de enviar toda la información.



curl --location --request PATCH 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}' \
--header 'accept: */*' \
--header 'Content-Type: application/merge-patch+json' \
--header 'Authorization: Bearer {access_token}' \
--header 'x-seller-identifier: {seller_identifier}' \
--header 'Cookie: csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E' \
--data-raw '{

"OdometerReadings":[
      {
         "Value":60000,
         "UnitOfMeasure":"KM"
      }
   ]
}'

fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', {
    method: 'PATCH',
    body: {
        "OdometerReadings":[
            {
            "Value":60000,
            "UnitOfMeasure":"KM"
            }
        ]},
        headers: {
            'accept': '*/*',
            'Content-Type': 'application/merge-patch+json',
            'Authorization': 'Bearer {access_token}',
            'x-seller-identifier': '{seller_identifier}',
            'Cookie': 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E'
        }
    }).then(response => response.json())
    .then(data => {
        console.log('Success:', data);
})


using System;
using System.Net.Http;
using Newtonsoft.Json;
...

async static void CreateVehicle()
{

    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/merge-patch+json');
    client.DefaultRequestHeaders.Add("x-seller-identifier", '{seller_identifier}');
    client.DefaultRequestHeaders.Add("Cookie", 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E');
    client.DefaultRequestHeaders.Add("accept", '*/*');

    var vehicle = new Vehicle("property1", "property2", ...);

    var json = JsonConvert.SerializeObject(vehicle);
    var data = new StringContent(json, Encoding.UTF8, "application/json");

    var uri = "http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}";

    var response = await client.PatchtAsync(uri);

    string result = response.Content.ReadAsStringAsync().Result;
    Console.WriteLine(result);
}

    $client = new GuzzleHttp\Client();

    $response = $client->request('PATCH', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', [
        'headers' => [
            'accept' => '*/*',
            'Content-Type' => 'application/merge-patch+json',
            'Authorization' => 'Bearer {access_token}',
            'x-seller-identifier' => '{seller_identifier}',
            'Cookie' => 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E'
        ],
        'body' => [
            'SaleStatus' => 'In Stock',
            'Description' => 'This is just a comment',
            'Key' => 'Value',
            'Key' => 'Value',
            ...
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Tomen en cuenta que para el uso de este endpoint es necesario enviar en el header el x-seller-identifier que es el identificador de la automotora.

Si el dato que se desea modificar está dentro de una lista, es necesario enviar la lista completa desde su nodo padre, por ejemplo si se quiere cambiar el tipo de transmisión (GearType) del vehículo el payload debe ser como el siguiente:


{
   "Specification":{
      "Attributes":[
         {
            "Name":"Color",
            "FeatureGroup":"Detalles",
            "DisplayName":"Color",
            "Value":"Blanco",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"DoorNumber",
            "FeatureGroup":"Detalles",
            "DisplayName":"Puertas",
            "Value":"4",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"BodyStyle",
            "FeatureGroup":"Detalles",
            "Value":"SUV",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"FuelType",
            "FeatureGroup":"Detalles",
            "Value":"Gas",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"GearType",
            "FeatureGroup":"Detalles",
            "Value":"Manual",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"TipoVehiculo",
            "FeatureGroup":"Detalles",
            "DisplayName":"Tipo Vehiculo",
            "Value":"Autos, Camionetas y 4x4",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         {
            "Name":"TipoCategoria",
            "FeatureGroup":"Detalles",
            "DisplayName":"Tipo Categoria",
            "Value":"Camioneta",
            "DisplayOnDetailsPage":true,
            "IsKeyAttribute":false,
            "IsDeleted":false
         },
         ....         
      ]
}

¡Atención! Si se desean eliminar los productos asignados, basta con enviar la propiedad Tags vacía "Tags":[] , como en el siguiente ejemplo:



{
   "Tags": []
}

Eliminación del Aviso

Hemos habilitado un endpoint para que la eliminación de los avisos sea mas sencilla.



curl --location --request DELETE 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}' \
--header 'accept: */*' \
--header 'Authorization: Bearer {access_token}' \
--header 'x-seller-identifier: {seller_identifier}' \
--header 'Cookie: csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E'

fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', {
    method: 'DELETE',
        headers: {
            'accept': '*/*',
            'Authorization': 'Bearer {access_token}',
            'x-seller-identifier': '{seller_identifier}',
            'Cookie': 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E'
        }
    }).then(response => response.json())
    .then(data => {
        console.log('Success:', data);
})


using System;
using System.Net.Http;
using Newtonsoft.Json;
...

async static void CreateVehicle()
{

    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("x-seller-identifier", '{seller_identifier}');
    client.DefaultRequestHeaders.Add("Cookie", 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E');
    client.DefaultRequestHeaders.Add("accept", '*/*');

    var uri = "http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}";

    var response = await client.DeleteAsync(uri);

    string result = response.Content.ReadAsStringAsync().Result;
    Console.WriteLine(result);
}

    $client = new GuzzleHttp\Client();

    $response = $client->request('DELETE', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/{InventoryIdentifier}', [
        'headers' => [
            'accept' => '*/*',
            'Authorization' => 'Bearer {access_token}',
            'x-seller-identifier' => '{seller_identifier}',
            'Cookie' => 'csncidcf=69DB9F96-EB3A-49F9-A600-50504FA6627E'
        ]
    ]);

    echo $response->getStatusCode(); // 200

Tomen en cuenta que para el uso de este endpoint es necesario enviar en el header el x-seller-identifier que es el identificador de la automotora.

Obtención de Inventario

Hemos habilitado un endpoint para puedas obtener el inventario de una sucursal específica.



curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/active_items?page=1&limit=100' \
--header 'accept: */*' \
--header 'Content-Type: application/merge-patch+json' \
--header 'Authorization: Bearer {{token}}' \
--header 'x-seller-identifier: {{seller_identifier}}' \
--data-raw ''

fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/active_items?page=1&limit=100', {
    headers: {
        'accept': '*/*',
        'Content-Type': 'application/merge-patch+json',
        'Authorization': 'Bearer {{token}}',
        'x-seller-identifier': '{{seller_identifier}}'
    }
});
})


using System.Net.Http.Headers;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/active_items?page=1&limit=100");

request.Headers.Add("accept", "*/*");
request.Headers.Add("Authorization", "Bearer {{token}}");
request.Headers.Add("x-seller-identifier", "{{seller_identifier}}");

request.Content = new StringContent("");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/merge-patch+json");

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();


 $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/vehicles/active_items?page=1&limit=100');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');


$headers = array();
$headers[] = 'Accept: */*';
$headers[] = 'Content-Type: application/merge-patch+json';
$headers[] = 'Authorization: Bearer {{token}}';
$headers[] = 'X-Seller-Identifier: {{seller_identifier}}';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

Tomen en cuenta que para el uso de este endpoint es necesario enviar en el header el x-seller-identifier que es el identificador de la automotora.

Estructura DTO
https://github.com/carsales/csn-dto

  • PublishingDestinations - indica dónde se hará la publicación del aviso. Para Chile, debería ser
  • InventoryIdentifier – GUID único que identifica la publicación
  • SellerIdentifier – GUID del vendedor
  • ListingType – Valores posibles – Nuevo or Usado
  • SaleStatus – Valores posibles – In Stock, Sold o Withdrawn
  • RecordType - Autos, camionetas y 4x4 para Autos
  • Tags – contiene la lista de productos contratados, tales como Premium, VIP, etc.
  • Specifications – los nombres de los atributos aplicables pertenecientes a este listado - https://github.com/carsales/csn-dto/blob/master/docs/car.attributes.json
  • Media -> Photos -> Url - La URL completa de la imagen.

Especificaciones y catálogo de vehículos

Al enviar el inventario, seguidamente los datos deben ser validados con el endpoint de especificaciones previamente gestionado.

  • Makes
  • Models
  • Specification -> Attributes -> BodyStyle
  • Specification -> Attributes -> FuelType
  • Specification -> Attributes -> GearType
  • Colours -> Name

Marcas



    curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''

    fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes', {
    method: 'GET',
    headers: {
    'Authorization': 'Bearer {access_token}'
    'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
    console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Modelos



    curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes/BMW/models' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''

    fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes/BMW/models', {
    method: 'GET',
    headers: {
    'Authorization': 'Bearer {access_token}'
    'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
    console.log('Success:', data);
    })

    using System;
    using System.Net.Http;
    using System.Threading.Tasks;
    using Newtonsoft.Json;

    async static void Search()
    {
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes/BMW/models';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
    }

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/makes/BMW/models', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Carrocería


curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/body_types' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''
fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/body_types', {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer {access_token}'
        'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
        console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/body_types';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/body_types', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Tipos de combustible


curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/fuel_types' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''
fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/fuel_types', {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer {access_token}'
        'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
        console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/fuel_types';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/fuel_types', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Tipos de motor


curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/gear_types' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''

    fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/gear_types', {
        method: 'GET',
        headers: {
        'Authorization': 'Bearer {access_token}'
        'Content-Type': 'application/json',
        },
        .then(response => response.json())
        .then(data => {
        console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/gear_types';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/gear_types', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

Colores


curl --location --request GET 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/colours' \
    --header 'Authorization: Bearer {access_token}' \
    --header 'Content-Type: application/json' \
    --data-raw ''
fetch('http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/colours', {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer {access_token}'
        'Content-Type': 'application/json',
    },
    .then(response => response.json())
    .then(data => {
        console.log('Success:', data);
    })

using System;
using System.Net.Http;
using System.Threading.Tasks;

async static void Search()
{
    //...
    HttpClient client = new HttpClient();
    client.DefaultRequestHeaders.Add("Authorization", 'Bearer {access_token}');
    client.DefaultRequestHeaders.Add("Content-Type", 'application/json');

    string uri = 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/colours';

    HttpResponseMessage response = await client.GetAsync(uri);

    string contentString = await response.Content.ReadAsStringAsync();
    dynamic parsedJson = JsonConvert.DeserializeObject(contentString);
    Console.WriteLine(parsedJson);
}

    $client = new \GuzzleHttp\Client();
    $response = $client->request('GET', 'http://globalinventory-publicapi.stg.core.csnglobal.net/v1/specifications/cl/car/colours', [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
            'Authorization'  => 'Bearer {access_token}'
        ]
    ]);

    echo $response->getStatusCode(); // 200
    echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
    echo $response->getBody(); // '{"Key":"Value", ...}'
    var_export($response->json());             // Outputs the JSON decoded data

A través del navegador, visite esta URL para validar si su aviso fue publicado correctamente. Para ello será necesario:

  • Para otorgar acceso, deberá proveer su IP Pública al correo soporte@chileautos.cl.
  • GUID de la publicación que desea validar.
    
        http://ds-integration-ore.s.core.csnglobal.net/detalle/_/{{advert_identifier}}?site=encoauto.chileautos.cl

        // Example

        http://ds-integration-ore.s.core.csnglobal.net/detalle/_/63473424-0689-4DB1-A3BD-6724FEADD8F0?site=encoauto.chileautos.cl
    

Envío de Leads

Sabemos lo importante que es recibir de manera inmediata cada uno de los leads generados en el sitio, es por eso que ofrecemos la opción de  integrarnos con tu sistema mediante el uso de webhooks.

Gracias a los webhooks, podrás recibir notificaciones HTTP en tiempo real sobre los leads que se generen en tus avisos. ¿ Cómo funciona? Veamos el siguiente diagrama:

Pasos para empezar a recibir notificaciones

  • Creación de un punto de conexión

Es responsabilidad de cada cliente proporcionar un punto de conexión real para que podamos enviar las notificaciones.

Tu punto de conexión debe tener la capacidad de procesar solicitudes HTTPS. Tu servidor debe tener un certificado TLS o SSL válido, correctamente configurado e instalado. No se admiten los certificados autofirmados.

Las notificaciones las enviamos a tu punto de conexión con una solicitud POST con una carga json que contiene toda la información del lead.

La autorización del HTTP POST para eso debes configurar tu punto de conexión con headers personalizados (fijos) específicos o parámetros query strings (fijos).

Ejemplo:


    access_token: 123
    Authorization: Basic abc
  • Configuración del punto de conexión

Una vez hayas finalizado tu desarrollo debes hacernos llegar email a soporte@chileautos.cl con la siguientes información:

1. Url del punto de conexión

2. Headers (en caso de que sea necesario)

3. Lista de agencias que estarán suscriptas a este punto de conexión.

¿Qué información enviamos al punto de conexión?

La estructura de los leads se basa en este DTO carsales/csn-dto en particular esta estructura
https://github.com/carsales/csn-dto/blob/master/Csn.Public.Dto/Lead/Lead.cs

Lead.cs


using System;
using System.Collections.Generic;

namespace Csn.Public.Dto
{
    public class Lead
    {
        public Lead()
        {
            Prospect = new Customer();
            Environment = new Environment();
        }

        /* required */
        public Guid Identifier { get; set; }
        /* ISO Short two char country codes, e.g. AU, NZ, US etc. */
        public string CountryCode { get; set; }
        public Customer Seller { get; set; }

        /* coded name provided for the company sending the lead e.g. CARSALES */
        public string Source { get; set; }

        /* 
            Type = [GENERAL, ITEM] 

            Should it be expected to have an item attached (ITEM) or not (GENERAL). 
            Note that ServiceRequests handle what services are being enquired on e.g. finance, insurance, service, sales etc.
            Item.ListingType handles whether the item is new, used or demo etc.
        */
        public string Type { get; set; }

        /* Status = [New, Contact, Commitment, Sold, Lost, Duplicate, Unworkable] */
        public string Status { get; set; }  

        public Environment Environment { get; set; }
        public Customer Prospect { get; set; }

        public string Comments { get; set; }
        public DateTime CreatedUtc { get; set; }
        public DateTime? ModifiedUtc { get; set; }

        /*
            Labels is replacing Tags, and provides a means to add labels of various types
            Type = [Private, System, Device, User]
            Value is used to denote the actual label itself.
        */
        public List Labels { get; set; }

        /* ServiceRequest.Type = [Finance, Insurance etc] */
        public List ServiceRequests { get; set; }

        public TelephoneCall PhoneCall { get; set; }

        public Vehicle Item { get; set; }
        public Vehicle TradeIn { get; set; }

        public List History { get; set; }
        public Assignment Assignment { get; set; }
        public List ExtendedProperties { get; set; }
    }

    public class Assignment
    {
        public Guid? Identifier { get; set; }
        public string Email { get; set; }
        public string Name { get; set; }
        public DateTime AssignedUtc { get; set; }
    }

    public class HistoryItem
    {
        public Guid? Identifier { get; set; }
        public string Type { get; set; }
        public DateTime CreatedUtc { get; set; }
        public string Note { get; set; }
        public string Status { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
    }

    public class Environment
    {
        /* location name of where the lead was submitted from */
        public string Source { get; set; }

        /* domain name of the site sending the lead */
        public string Url { get; set; }

        /* IP address of the users device submitting the lead - helpful in tracking spam etc. */
        public string IpAddress { get; set; }

        /* an identifier of the session for the user submitting the lead - assists with lead tracking */
        public string SessionId { get; set; }
    }
}


{
  "Identifier": "00000000-0000-0000-0000-000000000000",
  "Seller": {
    "Identifier": "00000000-0000-0000-0000-000000000000",
    "Type": null,
    "Name": null,
    "Email": null,
    "Addresses": [
      {
        "Line1": null,
        "Line2": null,
        "Suburb": null,
        "State": null,
        "Country": null,
        "CountryCode": null
      }
    ],
    "PhoneNumbers": [
      {
        "Type": null,
        "Number": null
      },
      {
        "Type": null,
        "Number": null
      }
    ]
  },
  "Source": null,
  "Type": null,
  "Status": null,
  "Environment": {
    "Source": null,
    "IpAddress": null
  },
  "Prospect": {
    "Identifier": "00000000-0000-0000-0000-000000000000",
    "Type": null,
    "Name": null,
    "Email": null,
    "Addresses": [],
    "PhoneNumbers": [
      {
        "Type": null,
        "Number": null
      },
      {
        "Type": null,
        "Number": null
      }
    ],
    "Identification": [
      {
        "Type": null,
        "Value": null
      },
      {
        "Type": null,
        "Value": null
      }
    ]
  },
  "CreatedUtc":  "0001-01-01T00:00:00",
  "Labels": [
    {
      "Type": null,
      "Value": null
    },
    {
      "Type": null,
      "Value": null
    },
    {
      "Type": null,
      "Value": null
    }
  ],
"Item": {
    "Type": null,
    "Identifier": "00000000-0000-0000-0000-000000000000",
    "ListingType": null,
    "SaleStatus": null,
    "Registration": {
      "Number": null
    },
    "Identification": [
      {
        "Type": null,
        "Value": null
      }
    ],
    "OdometerReadings": [
      {
        "Value": null
      }
    ],
    "Seller": {
      "Identifier": "00000000-0000-0000-0000-000000000000"
    },
    "Specification": {
      "Make": null,
      "Model": null,
      "ReleaseDate": {
        "Year": null
      },
      "Title": null
    },
    "Media": {
      "Photos": [
        {
          "Url": null
        }
      ],
      "Videos": [],
      "Links": [
        {
          "Type": null,
          "Url": null
        }
      ]
    },
    "ComplianceDate": {},
    "BuildDate": {},
    "Warranty": {},
    "PriceList": [
      {
        "Currency": null,
        "Amount": null
      }
    ],
    "ExtendedProperties": [
      {
        "Name": null,
        "Value": nnll
      },
      {
        "Name": null,
        "Value": null
      },
      {
        "Name": null,
        "Value": null
      }
    ]
  },
  "ExtendedProperties": []
}


Ejemplo


{
  "Identifier": "83ff5b22-5767-4759-bb6b-aab13c28992b",
  "Seller": {
    "Identifier": "448b6a1c-cd6c-44aa-9ff1-f05f150831aa",
    "Type": "Seller",
    "Name": "Automotora Ejemplo",
    "Email": "autos@ejemplo.cl",
    "Addresses": [
      {
        "Line1": "Av. Vitacura 10001",
        "Line2": "",
        "Suburb": "Vitacura",
        "State": "Santiago",
        "Country": "Chile",
        "CountryCode": "CL"
      }
    ],
    "PhoneNumbers": [
      {
        "Type": "Work",
        "Number": "9984429490"
      },
      {
        "Type": "Home",
        "Number": "9984429490"
      }
    ]
  },
  "Source": "chileautos",
  "Type": "Usado",
  "Status": "New",
  "Environment": {
    "Source": "desktop.chileautos",
    "IpAddress": "181.42.18.41"
  },
  "Prospect": {
    "Identifier": "543e8e52-098c-401b-8214-5ad9c1e98505",
    "Type": "Prospect",
    "Name": "Manuel Galdamez",
    "Email": "mgaldamez@email.com",
    "Addresses": [],
    "PhoneNumbers": [
      {
        "Type": "Home",
        "Number": "+56912314874"
      },
      {
        "Type": "Mobile",
        "Number": "+56912314874"
      }
    ],
    "Identification": [
      {
        "Type": "Name",
        "Value": "Manuel"
      },
      {
        "Type": "LastName",
        "Value": "Galdamez"
      }
    ]
  },
  "CreatedUtc": "2024-10-01T00:30:43.0527329Z",
  "Labels": [
    {
      "Type": "Tag",
      "Value": "Used"
    },
    {
      "Type": "Tag",
      "Value": "PhotoTypeDealer"
    },
    {
      "Type": "Tag",
      "Value": "Billable"
    }
  ],
  "Item": {
    "Type": "Car",
    "Identifier": "1191238c-e705-4e61-80d6-05d9b96ccae6",
    "ListingType": "Usado",
    "SaleStatus": "In Stock",
    "Registration": {
      "Number": "LGWX99"
    },
    "Identification": [
      {
        "Type": "NetworkId",
        "Value": "CL-SELLER-9999"
      }
    ],
    "OdometerReadings": [
      {
        "Value": 89000.0
      }
    ],
    "Seller": {
      "Identifier": "7132bc5b-ef1a-46f8-a535-94dbea03caf4"
    },
    "Specification": {
      "Make": "Nissan",
      "Model": "NP300",
      "ReleaseDate": {
        "Year": 2018
      },
      "Title": "2018 Nissan Np300 NP 300 XE 2.3 MT 4X2 DSL DC E5 JYVJ37"
    },
    "Media": {
      "Photos": [
        {
          "Url": "/car/dealer/a177730hltt9rmj7704zsnqnp.jpg"
        },
        {
          "Url": "/car/dealer/dnvbjv3emhme3z09f5s5st44c.jpg"
        }
      ],
      "Videos": [],
      "Links": [
        {
          "Type": "Details",
          "Url": "https://www.chileautos.cl/details/1112318c-e705-4e61-80d6-05d9b55ccae6"
        }
      ]
    },
    "ComplianceDate": {},
    "BuildDate": {},
    "Warranty": {},
    "PriceList": [
      {
        "Currency": "CLP",
        "Amount": 15000000
      }
    ],
    "ExtendedProperties": [
      {
        "Name": "TRIGGERSECTION",
        "Value": "topright"
      },
      {
        "Name": "SellerId",
        "Value": "CL-SELLER-999"
      },
      {
        "Name": "NetworkId",
        "Value": "GI-AD-999999"
      }
    ]
  },
  "ExtendedProperties": []
}

Tipos de Leads

Dependiendo de los servicios contratados podrás recibir leads de diferentes fuentes, entre estas fuentes tenemos:

  • Chileautos: Son los leads que provienen de nuestro sitio.

  • WhatsApp: Son los leads generados mediante nuestro servicio de Whatsapp Premium.

  • ChileautosLeadPremium: Son los leads que provienen de nuestro sitio cuando se solicita financiamiento.

Para diferenciar uno de otro solo es necesario validar la información incluida en el campo Source

Para el caso de Lead Premium la única diferencia es que dentro de extendedProperties viene el Rut ingresado en el formulario de contacto.


  "extendedProperties": [
      {
        "Name": "RUT",
        "Value": "17423700-k"
      }
  ]

API Responses

HTTP Status Code 400:

Solicitud inválida

HTTP Status Code 401:

Falla de autenticación / credenciales erróneas

HTTP Status Code 202:

El servidor aceptó y completó la solicitud como se esperaba.

HTTP Status Code 500:

El servidor falló al intentar completar la solicitud debido a un error interno.

HTTP Status Code 503:

El servicio solicitado no está disponible.

Contacto

Para más información, por favor escribir a soporte@chileautos.cl