Jump to content

Problem creating new category with rest API


golemus

Recommended Posts

Hello,

I am trying to create a new category using the REST api and POST,

I created an access key with privileges on categories.

the command I use is

curl -u 'myaccesskey:' -d @myxml 'http://myurl/shop/api/categories/'

 

and myxml is a file containing

 

xml='<category>

<id_parent>5</<id_parent>

<active>1</active>

<name><language id="1">TestCategory</language>

<language id="2">TestCategory</language>

<language id="3">TestCategory</language>

<language id="4">TestCategory</language>

<language id="5">TestCategory</language>

</name>

<link_rewrite>

<language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/>

</link_rewrite>

<meta_title>

<language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/>

</meta_title>

<meta_description>

<language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/>

</meta_description>

<meta_keywords>

<language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/></meta_keywords>

<description>

<language id="1"/><language id="2"/><language id="3"/><language id="4"/><language id="5"/></description>

<associations><categories/><products/></associations></category>'

 

 

I get an

error code 127

XML error : String could not be parsed as XML

even if xml looks valid and is built from

/api/categories?schema=blank

 

my prestashop is version 1.4.6.2

PHP: 5.3.3

 

any hints?

 

Thanks

G.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...