Jump to content

Webservice, problem with creating resources


Recommended Posts

Hello!

I have problem with crating resource when I use webservice. I execute comunicaton by folowing steps:

 

1. Getting a blank resource by "GET":

request:

GET /prestashop/api/categories?schema=blank HTTP/1.1
Authorization: Basic SUVOSTdEOERIMURGNTUyN0xCNjhNRUQ0OVNUTzFCNEM6
Host: localhost
Connection: Keep-Alive
User-Agent: RestClient-Tool

response:

HTTP/1.1 200 OK
Access-Time: 1346786014
Execution-Time: 0.065
Date: Tue, 04 Sep 2012 19:13:34 GMT
Content-Length: 680
PSWS-Version: 1.4.8.2
Keep-Alive: timeout=5, max=100
Content-Type: text/xml;charset=utf-8
Connection: Keep-Alive
X-Powered-By: PrestaShop Webservice
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
Content-Sha1: 7022a74c0ee872e3b816c9ccce2ab7f88c186c2b
<?xml version="1.0" ?>
<prestashop>
 <category>
<id></id>
<id_parent></id_parent>
<active></active>
<name>
  <language id="6"></language>
</name>
<link_rewrite>
  <language id="6"></language>
</link_rewrite>
<meta_title>
  <language id="6"></language>
</meta_title>
<meta_description>
  <language id="6"></language>
</meta_description>
<meta_keywords>
  <language id="6"></language>
</meta_keywords>
<description>
  <language id="6"></language>
</description>
<associations>
  <categories>
	<category>
	  <id></id></category></categories>
  <products>
	<product>
	  <id></id></product></products></associations></category></prestashop>

2. Creating new instance by "POST":

request:

POST /prestashop/api/categories
HTTP/1.1
Authorization: Basic SUVOSTdEOERIMURGNTUyN0xCNjhNRUQ0OVNUTzFCNEM6
Content-Length: 618
Content-Type: text/plain; charset=UTF-8
Host: localhost
Connection: Keep-Alive
User-Agent: RestClient-Tool
<?xml version="1.0" ?>
<prestashop>
 <category>
<id></id>
<id_parent>1</id_parent>
<active>1</active>
<name>
  <language id="6">new instance name</language></name>
<link_rewrite>
  <language id="6">link name</language></link_rewrite>
<meta_title>
  <language id="6"></language></meta_title>
<meta_description>
  <language id="6"></language></meta_description>
<meta_keywords>
  <language id="6"></language></meta_keywords>
<description>
  <language id="6"></language></description></category>
</prestashop>

response:

HTTP/1.1 500 Internal Server Error
Access-Time: 1346786551
Execution-Time: 0.012
Date: Tue, 04 Sep 2012 19:22:31 GMT
Content-Length: 282
PSWS-Version: 1.4.8.2
Content-Type: text/xml;charset=utf-8
Connection: close
X-Powered-By: PrestaShop Webservice
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
<?xml version="1.0" ?>
<prestashop>
 <errors>
<error>
  <code>127</code>
  <message>XML error : String could not be parsed as XML
XML length : 0
Original XML : </message></error></errors></prestashop>

It's seams that xml is invalid, but I use the same xml to update reasources with succes. When I updating resource I set id and I using PUT method. Interesting issue is error which talks XML length is 0.

 

What the problem is?

Edited by Saturnimus (see edit history)
Link to comment
Share on other sites

  • 2 months later...
×
×
  • Create New...