J'ai essayé d'ajouter une nouvelle collection personnalisée à l'aide de l'API Shopify. Mais continué à obtenir Erreur pour le titre ne peut pas être vide.API Shopify: Erreur lors de la création d'une nouvelle collection personnalisée. {"errors": {"title": ["ne peut pas être vide"]}}
Bien que le titre est déjà défini dans les champs POST
Mon code est comme ci-dessous:
$url = 'https://APIKEY:[email protected]/admin/custom_collections.json';
$collection = array
(
"custom_collection" => array('title' => 'Made In the USA')
);
// $payload = json_encode($collection);
$payload = '{
"custom_collection": {
"title": "IPods",
"collects": [
{
"product_id": 99395358
}
]
}
}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'HAC');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $payload);
$return = curl_exec($ch);
curl_close($ch);
Je reçois une réponse
{"errors":{"title":["can't be blank"]}}