How to edit Categories or Sub-Categories via API?


POST: http://www.nomedoseusite.com.br/api_categories.php?action=edit_categories

Parameter Format Description
categories_id JSON Categorie or Sub-Categorie ID
Only number is required
Format: int(11)
* FIELD REQUIRED
categories_name JSON

Categorie or Sub-Categorie Name
Format: varchar(255)
* FIELD REQUIRED

categories_status JSON 1 = ACTIVE or 0 = INACTIVE
Only number is required
Format: int(1)
* FIELD REQUIRED
sort_order JSON Sort Order
Only number is required
Format: int(3)
meta_title JSON Meta Title
Format: text
meta_description JSON Meta Description
Format: text
meta_keywords JSON Meta Keywords
Format: text

PHP Sample

 

	// sample edit categories and sub-categories
	
	$url = $domain_url . '/api_categories.php?action=edit_categories';

	$data = array("categories_id" => "182", // Categorie or Sub-Categorie ID (Only number is required) * FIELD REQUIRED
				  "categories_name" => "Categorie or Sub-Categorie Name", // Categorie or Sub-Categorie Name * FIELD REQUIRED
				  "categories_status" => "1", // 1 = ACTIVE or 0 = INACTIVE (Only number is required) * FIELD REQUIRED
				  "sort_order" => "", // Sort Order (Only number is required)
				  "meta_title" => "Meta Title", // Meta Title
				  "meta_description" => "Meta Description", // Meta Description
				  "meta_keywords" => "Meta Keywords"
				  );
				  
	$data_string = json_encode($data);  

	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);                                                                   
	curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
		'Content-Type: application/json', 
		"Cache-Control: no-cache", 
		'Usuario1: ' . base64_encode($usuario1),
		'Senha1: ' . base64_encode($senha1),                                                                               
		'Content-Length: ' . strlen($data_string))                                                                       
	);                                                                                                                   
																														 
	$result = curl_exec($ch);
	curl_close($ch);

	print_r($result);
	
	// sample edit categories and sub-categories eof

 

Return Error:

code
message

Return Success:

code
id
message

2018-08-30 13:22 MFORMULA {writeRevision}
Average rating: 0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

{debugMessages}