WooCommerce.NET icon indicating copy to clipboard operation
WooCommerce.NET copied to clipboard

Media.Add error

Open acerov opened this issue 4 years ago • 7 comments

Wordpress version 5.4.1 WooCommerce version 4.0.1 WooCommerce.NET version 0.8.2

.htaccess: RewriteCond %{HTTP:Authorization} ^(.) RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1]

My code: RestAPI restwp = new RestAPI("https://test.com/wp-json", "user", "pass"); WooCommerce.NET.WordPress.v2.WPObject wp = new WooCommerce.NET.WordPress.v2.WPObject(restwp); await wp.Media.Add("logo", @"C:\logo.jpg");

Media.Add returns error "There was an error deserializing the object of type WooCommerce.NET.WordPress.v2.Media. Encountered unexpected character 'o'."

Please help

acerov avatar May 16 '20 15:05 acerov

I finally got Media.Add working, but now I can not work with Woocommerce api it gives error "{"code":"jwt_auth_bad_auth_header","message":"Authorization header malformed.","data":{"status":403}}"

acerov avatar May 16 '20 17:05 acerov

Anyone?

acerov avatar May 18 '20 15:05 acerov

I had this second error with malformed, and doing this fixed it: https://wordpress.org/support/topic/error-with-authorization-header-malformed/

Going to plugin editor for JWT plugin and commenting the lines the last comment says to

Yoonwoo avatar May 25 '20 04:05 Yoonwoo

Wordpress version 5.4.1 WooCommerce version 4.0.1 WooCommerce.NET version 0.8.2

.htaccess: RewriteCond %{HTTP:Authorization} ^(.) RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1]

My code: RestAPI restwp = new RestAPI("https://test.com/wp-json", "user", "pass"); WooCommerce.NET.WordPress.v2.WPObject wp = new WooCommerce.NET.WordPress.v2.WPObject(restwp); await wp.Media.Add("logo", @"C:\logo.jpg");

Media.Add returns error "There was an error deserializing the object of type WooCommerce.NET.WordPress.v2.Media. Encountered unexpected character 'o'."

Please help

How to resolve this??? I have a same problem. Thanks!!!

mnieblab avatar Jun 09 '20 16:06 mnieblab

Wordpress version 5.4.1 WooCommerce version 4.0.1 WooCommerce.NET version 0.8.2 .htaccess: RewriteCond %{HTTP:Authorization} ^(.) RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1] My code: RestAPI restwp = new RestAPI("https://test.com/wp-json", "user", "pass"); WooCommerce.NET.WordPress.v2.WPObject wp = new WooCommerce.NET.WordPress.v2.WPObject(restwp); await wp.Media.Add("logo", @"C:\logo.jpg"); Media.Add returns error "There was an error deserializing the object of type WooCommerce.NET.WordPress.v2.Media. Encountered unexpected character 'o'." Please help

How to resolve this??? I have a same problem. Thanks!!!

Same problem here to.

HudsonRomeu avatar Jul 21 '20 19:07 HudsonRomeu

Wordpress version 5.4.1 WooCommerce version 4.0.1 WooCommerce.NET version 0.8.2 .htaccess: RewriteCond %{HTTP:Authorization} ^(.) RewriteRule ^(.) - [E=HTTP_AUTHORIZATION:%1] My code: RestAPI restwp = new RestAPI("https://test.com/wp-json", "user", "pass"); WooCommerce.NET.WordPress.v2.WPObject wp = new WooCommerce.NET.WordPress.v2.WPObject(restwp); await wp.Media.Add("logo", @"C:\logo.jpg"); Media.Add returns error "There was an error deserializing the object of type WooCommerce.NET.WordPress.v2.Media. Encountered unexpected character 'o'." Please help

How to resolve this??? I have a same problem. Thanks!!!

Same problem here to.

I solved the problem by installing on wordpress this plugin: https://wordpress.org/plugins/woo-media-api/

I edited the files to work with woocomerce v3 version. After this, you can add the Media.cs on your project and update the RestApi.cs, both are on zip file above: https://drive.google.com/file/d/1H6TlFz7gF-cXd5Bja3mtfAayz4qFevCK/view?usp=sharing

HudsonRomeu avatar Jul 22 '20 13:07 HudsonRomeu

Hi @HudsonRomeu, Your files uploaded to google drive aren't available anymore. Could you share the adaptations you made to make it compatible with the WooCommerce Media API ? Thanks in advance,

fredoche1810 avatar Jan 05 '22 17:01 fredoche1810