0
votes

I'm trying to create category with magento soap v2 api call. I'm getting the error:

Attribute "available_sort_by" is required.

Code for calling the Api:

$category_data = array( "name" => "testcategory", "is_active" => "1", "include_in_menu" => "1","available_sort_by" => "","default_sort_by" => "");

$result = $client->catalogCategoryCreate($session,2,$category_data,1); echo $result;

I have tried also with "available_sort_by" => array("name", "price", ...)

Is this the right way for calling the v2 soap api.

Thanks for any advice.

1

1 Answers

-2
votes

The WSDL does define what data you need for your call and exposes it for you to look at if you put 'trace' on your API SOAP calls.

After your call, with trace on, you can get your last XML, but it will be tidied up by the SOAP to be shoehorned into what the WSDL thinks you need for that call. The data will be different to what you submitted and show fields you never knew were in existence - it kind of reveals the documentation that you wish you had to start with.