Skip to main content
Adds a cut point record to the catalog. If the vehicle does not yet exist, pass vehicleId: null along with a vehicleData object to create both the vehicle and the cut in a single request. If the vehicle already exists, pass its vehicleId and omit vehicleData. Endpoint: WRITE service Action: addOrUpdateCut
Run checkVehicle before this action to determine whether you should create a new vehicle or attach the cut to an existing one.

Request

action
string
required
Must be "addOrUpdateCut".
payload.vehicleId
number | null
required
The ID of an existing vehicle to attach the cut to, or null to create a new vehicle.
payload.vehicleData
object
Required when vehicleId is null. Omit when attaching to an existing vehicle.
payload.cutData
object
required
The cut point details to add.
payload.colaborador
string
required
Name of the technician contributing this cut record.

Response

status
string
required
Always "success" on success.
vehicleId
number
The ID of the vehicle that was created or updated.

Example

const WRITE_ENDPOINT = 'https://script.google.com/macros/s/AKfycbyzP3RwEAqxJN8xzrqxjlsChx4xDgRuvpW-ygWM9teMHM0hWl0DDx91gR3TTR832BWakQ/exec';

// Adding a cut to a new vehicle
const response = await fetch(WRITE_ENDPOINT, {
  method: 'POST',
  headers: { 'Content-Type': 'text/plain' },
  body: JSON.stringify({
    action: 'addOrUpdateCut',
    payload: {
      vehicleId: null,
      vehicleData: {
        marca: 'Toyota',
        modelo: 'Corolla',
        anoDesde: '2020',
        tipoEncendido: 'Push Button',
        categoria: 'Automóviles',
        versionesAplicables: 'XSE',
        imagenVehiculo: 'data:image/jpeg;base64,/9j/4AAQ...'
      },
      cutData: {
        tipoCorte1: 'Bomba de Combustible',
        configRelay1: 'NA5',
        ubicacionCorte1: 'Bajo el asiento trasero, conector gris 4 pines',
        colorCableCorte1: 'Verde con blanco',
        imgCorte1: 'data:image/jpeg;base64,/9j/4AAQ...'
      },
      colaborador: 'Juan Díaz'
    }
  }),
  redirect: 'follow'
});

const result = await response.json();
if (result.status === 'success') {
  console.log('Vehicle ID:', result.vehicleId);
}

Build docs developers (and LLMs) love