Search the Community
Showing results for tags 'restfull'.
-
Hi everyone. I'm new in this forums, thanks for reading. I've tried the prestashop webservice using the php example script located in the documentation and i've read it all. It's really easy and works great. But now i'm trying to use the webservice via cURL command line client. i managed to make GET, PUT, and DELETE requests but when i try to make a POST request i get a HTTP/1.1 500 Internal Server Error. This is the command i launch: curl -v -X POST -H "Content-type:text/xml" --data-urlencode @cnew.xml "http://JXDLSL4MTV0GLFFNIMC4H35L4DV93IYP:@192.168.1.3/prestashop/api/customers/" I use -v for verbose. I get this: * About to connect() to 192.168.1.3 port 80 (#0) * Trying 192.168.1.3... connected * Connected to 192.168.1.3 (192.168.1.3) port 80 (#0) * Server auth using Basic with user 'JXDLSL4MTV0GLFFNIMC4H35L4DV93IYP' > POST /prestashop/api/customers/ HTTP/1.1 > Authorization: Basic SlhETFNMNE1UVjBHTEZGTklNQzRIMzVMNERWOTNJWVA6 > User-Agent: curl/7.21.7 (i386-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2 .5 libidn/1.18 libssh2/1.2.8 librtmp/2.3 > Host: 192.168.1.3 > Accept: */* > Content-type: text/xml > Content-Length: 989 > < HTTP/1.1 500 Internal Server Error < Date: Fri, 22 Jun 2012 08:59:59 GMT < 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 < X-Powered-By: PrestaShop Webservice < Access-Time: 1340355599 < PSWS-Version: 1.4.7.0 < Execution-Time: 0.016 < Content-Length: 241 < Connection: close < Content-Type: text/xml;charset=utf-8 < <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <errors> <error> <message><![CDATA[internal error. To see this error please display the PHP error s.]]></message> </error> </errors> </prestashop> * Closing connection #0 The content of cnew.xml file is a new customer: <?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> <customer> <id></id> <id_default_group></id_default_group> <newsletter_date_add></newsletter_date_add> <ip_registration_newsletter></ip_registration_newsletter> <last_passwd_gen></last_passwd_gen> <secure_key></secure_key> <deleted></deleted> <passwd></passwd> <lastname>Ñoréz</lastname> <firstname>Trinitarió Fúlgencio</firstname> <email>[email protected]</email> <note></note> <id_gender></id_gender> <birthday></birthday> <newsletter></newsletter> <optin></optin> <active>1</active> <is_guest></is_guest> </customer> </prestashop> If I use --trace-ascii instead of -v: curl --trace-ascii err.txt -X POST -H "Content-type:text/xml" --data-urlencode @cnew.xml "http://JXDLSL4MTV0GLFFNIMC4H35L4DV93IYP:@192.168.1.3/prestashop/api/customers/" I get a err.txt file with more information. This is its content: == Info: About to connect() to 192.168.1.3 port 80 (#0) == Info: Trying 192.168.1.3... == Info: connected == Info: Connected to 192.168.1.3 (192.168.1.3) port 80 (#0) == Info: Server auth using Basic with user 'JXDLSL4MTV0GLFFNIMC4H35L4DV93IYP' => Send header, 308 bytes (0x134) 0000: POST /prestashop/api/customers/ HTTP/1.1 002a: Authorization: Basic SlhETFNMNE1UVjBHTEZGTklNQzRIMzVMNERWOTNJWVA 006a: 6 006d: User-Agent: curl/7.21.7 (i386-pc-win32) libcurl/7.21.7 OpenSSL/0 00ad: .9.8r zlib/1.2.5 libidn/1.18 libssh2/1.2.8 librtmp/2.3 00e5: Host: 192.168.1.3 00f8: Accept: */* 0105: Content-type: text/xml 011d: Content-Length: 989 0132: => Send data, 989 bytes (0x3dd) 0000: %3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0 0040: A%3Cprestashop%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F19 0080: 99%2Fxlink%22%3E%0A%3Ccustomer%3E%0A%09%3Cid%3E%3C%2Fid%3E%0A%09 00c0: %3Cid_default_group%3E%3C%2Fid_default_group%3E%0A%09%3Cnewslett 0100: er_date_add%3E%3C%2Fnewsletter_date_add%3E%0A%09%3Cip_registrati 0140: on_newsletter%3E%3C%2Fip_registration_newsletter%3E%0A%09%3Clast 0180: _passwd_gen%3E%3C%2Flast_passwd_gen%3E%0A%09%3Csecure_key%3E%3C% 01c0: 2Fsecure_key%3E%0A%09%3Cdeleted%3E%3C%2Fdeleted%3E%0A%09%3Cpassw 0200: d%3E%3C%2Fpasswd%3E%0A%09%3Clastname%3E%C3%91or%C3%A9z%3C%2Flast 0240: name%3E%0A%09%3Cfirstname%3ETrinitari%C3%B3%20F%C3%BAlgencio%3C% 0280: 2Ffirstname%3E%0A%09%3Cemail%3Etrini%40nor.ez%3C%2Femail%3E%0A%0 02c0: 9%3Cnote%3E%3C%2Fnote%3E%0A%09%3Cid_gender%3E%3C%2Fid_gender%3E% 0300: 0A%09%3Cbirthday%3E%3C%2Fbirthday%3E%0A%09%3Cnewsletter%3E%3C%2F 0340: newsletter%3E%0A%09%3Coptin%3E%3C%2Foptin%3E%0A%09%3Cactive%3E1% 0380: 3C%2Factive%3E%0A%09%3Cis_guest%3E%3C%2Fis_guest%3E%0A%3C%2Fcust 03c0: omer%3E%0A%3C%2Fprestashop%3E <= Recv header, 36 bytes (0x24) 0000: HTTP/1.1 500 Internal Server Error <= Recv header, 37 bytes (0x25) 0000: Date: Fri, 22 Jun 2012 08:32:26 GMT <= Recv header, 99 bytes (0x63) 0000: Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/ 0040: 5.3.8 mod_perl/2.0.4 Perl/v5.10.1 <= Recv header, 37 bytes (0x25) 0000: X-Powered-By: PrestaShop Webservice <= Recv header, 25 bytes (0x19) 0000: Access-Time: 1340353946 <= Recv header, 23 bytes (0x17) 0000: PSWS-Version: 1.4.7.0 <= Recv header, 23 bytes (0x17) 0000: Execution-Time: 0.015 <= Recv header, 21 bytes (0x15) 0000: Content-Length: 241 <= Recv header, 19 bytes (0x13) 0000: Connection: close <= Recv header, 38 bytes (0x26) 0000: Content-Type: text/xml;charset=utf-8 <= Recv header, 2 bytes (0x2) 0000: <= Recv data, 241 bytes (0xf1) 0000: <?xml version="1.0" encoding="UTF-8"?>.<prestashop xmlns:xlink=" 0040: http://www.w3.org/1999/xlink">.<errors>.<error>.<message><![CDAT 0080: A[internal error. To see this error please display the PHP error 00c0: s.]]></message>.</error>.</errors>.</prestashop>. == Info: Closing connection #0 I've tried several "-H" options (headers) like: -H "Content-type:text/xml" and -H "Content-type:application/x-www-form-urlencoded" but I always get HTTP/1.1 500 Internal Server Error Can anybody help me PLEASE? Thanks in advance!!! -- Pamela Curts
- 8 replies
-
- webservice
- http
- (and 8 more)