Administra tu inventario mediante programación -- agrega anuncios, actualiza el estado y sube fotos sin abrir el sitio.
Cada solicitud (excepto los endpoints de referencia públicos) debe incluir tu token en el encabezado Authorization:
Authorization: Bearer osk_your_token_hereLos tokens están vinculados a tu cuenta -- cada anuncio que crees, edites o consultes a través de la API se limita únicamente a tu propio inventario.
Un anuncio creado a través de la API siempre comienza como borrador, igual que si lo iniciaras manualmente en el sitio -- no puede publicarse sin al menos una foto, y esta llamada no puede incluir una.
La cuenta a la que pertenece tu token
curl https://onlysalvage.com/api/v1/me/ \
-H "Authorization: Bearer osk_your_token_here"Valores válidos para status, vehicle_type, fuel_type, etc.
curl https://onlysalvage.com/api/v1/schema/choices/Todas las opciones que puede tener un anuncio: consulta los ids y envíalos como "options" al crear o actualizar un anuncio (no requiere token)
curl https://onlysalvage.com/api/v1/options/Lista todas las marcas de vehículos (no requiere token)
curl https://onlysalvage.com/api/inventory/makes/Lista los modelos de una marca específica (no requiere token)
curl "https://onlysalvage.com/api/inventory/models/?make=21"Lista tus propios anuncios -- se puede filtrar, ver más abajo
curl "https://onlysalvage.com/api/v1/listings/?status=AV&min_price=5000" \
-H "Authorization: Bearer osk_your_token_here"Crea un anuncio nuevo (siempre comienza como borrador)
curl -X POST https://onlysalvage.com/api/v1/listings/ \
-H "Authorization: Bearer osk_your_token_here" \
-H "Content-Type: application/json" \
-d '{
"vin": "1HGCM82633A004352",
"year": 2018,
"make": 21,
"model": 186,
"price": 9500,
"vehicle_type": "SDN",
"title_document": "SA"
}'Obtiene uno de tus anuncios
curl https://onlysalvage.com/api/v1/listings/123/ \
-H "Authorization: Bearer osk_your_token_here"Edita los campos de un anuncio (se admiten actualizaciones parciales)
curl -X PATCH https://onlysalvage.com/api/v1/listings/123/ \
-H "Authorization: Bearer osk_your_token_here" \
-H "Content-Type: application/json" \
-d '{"price": 8900, "description": "Price reduced -- motivated seller."}'Elimina permanentemente un anuncio y sus fotos
curl -X DELETE https://onlysalvage.com/api/v1/listings/123/ \
-H "Authorization: Bearer osk_your_token_here"
# 204 No Content on successCambia solo el estado de un anuncio
curl -X POST https://onlysalvage.com/api/v1/listings/123/status/ \
-H "Authorization: Bearer osk_your_token_here" \
-H "Content-Type: application/json" \
-d '{"status": "AV"}'Vuelve a subir un anuncio elegible a la parte superior
curl -X POST https://onlysalvage.com/api/v1/listings/123/renew/ \
-H "Authorization: Bearer osk_your_token_here"Lista las fotos de un anuncio
curl https://onlysalvage.com/api/v1/listings/123/images/ \
-H "Authorization: Bearer osk_your_token_here"Sube una foto, por archivo o image_url -- añade photo_type para subir una foto de daños en vez de una foto de galería
curl -X POST https://onlysalvage.com/api/v1/listings/123/images/ \
-H "Authorization: Bearer osk_your_token_here" \
-F "file=@photo.jpg"
# or, from an existing hosted URL instead of a local file:
curl -X POST https://onlysalvage.com/api/v1/listings/123/images/ \
-H "Authorization: Bearer osk_your_token_here" \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/photo.jpg"}'
# add photo_type=before_repair to upload a damage photo instead of a
# regular gallery photo (omit it, or send "gallery", for a normal photo):
curl -X POST https://onlysalvage.com/api/v1/listings/123/images/ \
-H "Authorization: Bearer osk_your_token_here" \
-F "file=@damage.jpg" \
-F "photo_type=before_repair"Elimina una sola foto
curl -X DELETE https://onlysalvage.com/api/v1/listings/123/images/456/ \
-H "Authorization: Bearer osk_your_token_here"
# 204 No Content on successAdjunta un PDF de Carfax, alineación o inspección
# Upload the file...
curl -X POST https://onlysalvage.com/api/v1/listings/123/documents/ \
-H "Authorization: Bearer osk_your_token_here" \
-F "type=carfax" \
-F "file=@carfax.pdf"
# ...or just send a link and we'll fetch it. The link must be publicly
# reachable and point straight at the PDF, not at a preview page.
curl -X POST https://onlysalvage.com/api/v1/listings/123/documents/ \
-H "Authorization: Bearer osk_your_token_here" \
-H "Content-Type: application/json" \
-d '{"type": "carfax", "file_url": "https://example.com/reports/carfax.pdf"}'Elimina un informe de Carfax, alineación o inspección
curl -X DELETE "https://onlysalvage.com/api/v1/listings/123/documents/?type=carfax" \
-H "Authorization: Bearer osk_your_token_here"
# 204 No Content on success