Link Search Menu Expand Document

Actualizar opción

Aactualizar una opción del producto.


PUT /api/rest_admin/productoptions/:id

Parámetros

get

id integerId de la opción.

post

{
    "option_description": {
        "2": {
            "name": "option2"
        }
    },
    "type": "select",
    "sort_order": "",
    "option_value": {
        "0": {
            "option_value_id": "", 
            "option_value_description": {
                "2": {
                    "name": "value21"
                }
            },
            "image": "", 
            "sort_order": ""
        },
        "1": {
            "option_value_id": "", 
            "option_value_description": {
                "2": {
                    "name": "value22"
                }
            },
            "image": "", 
            "sort_order": ""
        }
    }
}

option_description objectDescripción.
option_description > 2 objectIdioma de la descripción. Ver tabla de idiomas e Id de idioma.
option_description > 2 name stringNombre.
type stringTipo de opción. Ver tabla de opciones del producto.
sort_order integerOrden de classificación de la opción.
option_value objectValores de la opción.
option_value > 0 > option_value_id integerId del valor.
option_value > 0 > option_value_description objectLista de nombres del valor para cada idioma.
option_value > 0 > option_value_description > 2 > name stringNombre del valor del idioma con id 2.
option_value > 0 > image stringNombre de la imágen associada, con la ruta completa.
option_value > 0 > sort_order integerOrden de classificación del valor.

Cabeceras HTTP

X-Sushi-Token-IdToken de autorización.

Respuesta

{
    "success": 1,
    "error": [],
    "data": ""
success integer0 si hay error, 1 si no hay error.
error stringDescripción del error.
data json objectDatos de respuesta.

Ejemplos

cURL
curl --location --request PUT 'http://sushi.loc/api/rest_admin/productoptions/15' \
--header 'X-Sushi-Token-Id: 43cu4ma6gdfqfeprav8bf3rpt7' \
--header 'Content-Type: application/json' \
--data-raw '{
    "option_description": {
        "2": {
            "name": "option2"
        }
    },
    "type": "select",
    "sort_order": "",
    "option_value": {
        "0": {
            "option_value_id": "", 
            "option_value_description": {
                "2": {
                    "name": "value21"
                }
            },
            "image": "", 
            "sort_order": ""
        },
        "1": {
            "option_value_id": "", 
            "option_value_description": {
                "2": {
                    "name": "value22"
                }
            },
            "image": "", 
            "sort_order": ""
        },
        "2": {
            "option_value_id": "", 
            "option_value_description": {
                "2": {
                    "name": "value23"
                }
            },
            "image": "", 
            "sort_order": ""
        }
    }
}
'
PHP - cURL
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://sushi.loc/api/rest_admin/productoptions/15",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS =>"{\n    \"option_description\": {\n        \"2\": {\n            \"name\": \"option2\"\n        }\n    },\n    \"type\": \"select\",\n    \"sort_order\": \"\",\n    \"option_value\": {\n        \"0\": {\n            \"option_value_id\": \"\", \n            \"option_value_description\": {\n                \"2\": {\n                    \"name\": \"value21\"\n                }\n            },\n            \"image\": \"\", \n            \"sort_order\": \"\"\n        },\n        \"1\": {\n            \"option_value_id\": \"\", \n            \"option_value_description\": {\n                \"2\": {\n                    \"name\": \"value22\"\n                }\n            },\n            \"image\": \"\", \n            \"sort_order\": \"\"\n        },\n        \"2\": {\n            \"option_value_id\": \"\", \n            \"option_value_description\": {\n                \"2\": {\n                    \"name\": \"value23\"\n                }\n            },\n            \"image\": \"\", \n            \"sort_order\": \"\"\n        }\n    }\n}\n",
  CURLOPT_HTTPHEADER => array(
    "X-Sushi-Token-Id: 43cu4ma6gdfqfeprav8bf3rpt7",
    "Content-Type: application/json"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;