Title: Woocommerce create order with hebrew text using the api retuns an error
Tags: wordpress;woocommerce
Question: I am using woocommerce Version 2.3.10 (i cant upgrade to the new version)
I am using API V2
I am creating an order using the API successfully
The entire order text is in english
once there is Hebrew in one of the fields (billing addres first name for example), I am getting an error when trying to create the order.
The error i am getting is: woocommerce_api_missing_callback_param
Any ideas how to fix it?
i tried to encode the text to unicode string but the string is not being decoded back to hebrew when the order is created.
There is no problem to open an order with hebrew in the regular website (not using the api
UPDATE:
I installed latest version of woocommerce and the problem remains the same
Comment: Show us some code you've tried. Also try creating a new WordPress install with latest WooCommerce and run the code against it to see if it works, if it does you know where the problem lies.

Comment: @uriz, can you show us some code you've tried?

Comment: @uriz, I have just created a test order using the API and it works, I set first_name =    אֱלֹהִ֑ים

Comment: If you are sure you are doing this correctly (meaning everything works in another language) then you may want to open an issue at [github](https://github.com/woothemes/woocommerce/issues).

Comment: Anand i tried it on latest version and there is the same error

Here is the accepted answer: I have successfully created an order using API v2, used a Hebrew word for the first_name field and it worked. I am pasting the code here so that you can check yours against it.
$p = $client-&gt;orders-&gt;create(
array (
'payment_details' =&gt; array(
"method_id" =&gt; "bacs",
"method_title" =&gt; "Direct Bank Transfer",
"paid" =&gt; true
),
'billing_address' =&gt; array(
"first_name" =&gt; "אֱלֹהִ֑ים",
"last_name" =&gt; "Almighty",
"address_1" =&gt; "969 Market",
"address_2" =&gt; "",
"city" =&gt; "San Francisco",
"state" =&gt; "CA",
"postcode" =&gt; "94103",
"country" =&gt; "US",
"email" =&gt; "brownmichele@example.org",
"phone" =&gt; "(555) 555-5555"
),
'shipping_address' =&gt; array(
"first_name" =&gt; "אֱלֹהִ֑ים",
"last_name" =&gt; "Almighty",
"address_1" =&gt; "969 Market",
"address_2" =&gt; "",
"city" =&gt; "San Francisco",
"state" =&gt; "CA",
"postcode" =&gt; "94103",
"country" =&gt; "US"
),
'line_items' =&gt; array(
array(
'product_id' =&gt; 579,
'quantity' =&gt; 2
)
),
'shippling_lines' =&gt; array(
array(
'method_id' =&gt; 'flat_rate',
'method_title' =&gt; 'Flat Rate',
'total' =&gt; 10
)
),
));
In the backend the order shows fine
EDIT : Adding the request headers and body as requested by OP
[SERVER_SOFTWARE] =&gt; Apache/2.4.16 (FreeBSD) PHP/5.6.13 Phusion_Passenger/4.0.59
[REQUEST_URI] =&gt; /wc-api/v2/orders?oauth_consumer_key=ck_640ffa61657f3db1653c10cbc137d4f1ab136a46&amp;oauth_timestamp=1442922853&amp;oauth_nonce=c60ad782ba9f0ee5c2e3e4af980ee21d01980153&amp;oauth_s
ignature_method=HMAC-SHA256&amp;oauth_signature=zv0spywKNaXEbwyEASC3o%2FDexf71jf7CJbF9tEI%2FbCU%3D
[HOME] =&gt; /nonexistent
[USER] =&gt; www
[FCGI_ROLE] =&gt; RESPONDER
[REDIRECT_STATUS] =&gt; 200
[proxy-nokeepalive] =&gt; 1
[HTTP_HOST] =&gt; wordpress
[HTTP_ACCEPT] =&gt; application/json
[CONTENT_TYPE] =&gt; application/json
[HTTP_USER_AGENT] =&gt; WooCommerce API Client-PHP/2.0.1
[CONTENT_LENGTH] =&gt; 734
[PATH] =&gt; /sbin:/bin:/usr/sbin:/usr/bin
[LD_LIBRARY_PATH] =&gt; /usr/local/lib
[SERVER_SIGNATURE] =&gt;
[SERVER_NAME] =&gt; wordpress
[SERVER_ADDR] =&gt; 151.154.11.224
[SERVER_PORT] =&gt; 80
[REMOTE_ADDR] =&gt; 151.154.11.224
[DOCUMENT_ROOT] =&gt; /usr/home/anand/wordpress/
[REQUEST_SCHEME] =&gt; http
[CONTEXT_PREFIX] =&gt;
[CONTEXT_DOCUMENT_ROOT] =&gt; /usr/home/anand/wordpress/
[SERVER_ADMIN] =&gt; brownmichele@example.org
[SCRIPT_FILENAME] =&gt; /usr/home/anand/wordpress/index.php
[REMOTE_PORT] =&gt; 13999
[REDIRECT_QUERY_STRING] =&gt; oauth_consumer_key=ck_640ffa61657f3db1653c10cbc137d4f1ab136a46&amp;oauth_timestamp=1442922853&amp;oauth_nonce=c60ad782ba9f0ee5c2e3e4af980ee21d01980153&amp;oauth_signature
_method=HMAC-SHA256&amp;oauth_signature=zv0spywKNaXEbwyEASC3o%2FDexf71jf7CJbF9tEI%2FbCU%3D
[REDIRECT_URL] =&gt; /wc-api/v2/orders
[GATEWAY_INTERFACE] =&gt; CGI/1.1
[SERVER_PROTOCOL] =&gt; HTTP/1.1
[REQUEST_METHOD] =&gt; POST
[QUERY_STRING] =&gt; oauth_consumer_key=ck_640ffa61657f3db1653c10cbc137d4f1ab136a46&amp;oauth_timestamp=1442922853&amp;oauth_nonce=c60ad782ba9f0ee5c2e3e4af980ee21d01980153&amp;oauth_signature_method=H
MAC-SHA256&amp;oauth_signature=zv0spywKNaXEbwyEASC3o%2FDexf71jf7CJbF9tEI%2FbCU%3D
[SCRIPT_NAME] =&gt; /index.php
[PHP_SELF] =&gt; /index.php
[REQUEST_TIME_FLOAT] =&gt; 1442922853.0845
[REQUEST_TIME] =&gt; 1442922853
{"order":{"payment_details":{"method_id":"bacs","method_title":"Direct Bank Transfer","paid":true},"billing_address":{"first_name":"\u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0591\u05d9\u05dd","
last_name":"Almighty","address_1":"969 Market","address_2":"","city":"San Francisco","state":"CA","postcode":"94103","country":"US","email":"brownmichele@example.org","phone":"(555) 555-5555"},
"shipping_address":{"first_name":"\u05d0\u05b1\u05dc\u05b9\u05d4\u05b4\u0591\u05d9\u05dd","last_name":"Almighty","address_1":"969 Market","address_2":"","city":"San Francisco","state":"CA",
"postcode":"94103","country":"US"},"line_items":[{"product_id":579,"quantity":2}],"shippling_lines":[{"method_id":"flat_rate","method_title":"Flat Rate","total":10}]}}
EDIT 2 : Adding C# specific piece of code
wc.Headers[HttpRequestHeader.ContentType] = "application/json";
wc.Encoding = Encoding.UTF8;
// Send the string as is
string coupon = "{ \"coupon\": { \"code\": \"new-coupon\", \"type\": \"percent\", \"amount\": \"10\", \"individual_use\": true, \"product_ids\": [], \"exclude_product_ids\": [], \"usage_limit\": \"\", \"usage_limit_per_user\": \"\", \"limit_usage_to_x_items\": \"\", \"expiry_date\": \"\", \"enable_free_shipping\": false, \"product_category_ids\": [], \"exclude_product_category_ids\": [], \"exclude_sale_items\": true, \"minimum_amount\": \"100.00\", \"maximum_amount\": \"0.00\", \"customer_emails\": [], \"description\": \"אֱלֹהִ֑ים\" } }";
var result = wc.UploadString(url, coupon);
// Encode the string
string coupon = "{ \"coupon\": { \"code\": \"new-coupon1\", \"type\": \"percent\", \"amount\": \"10\", \"individual_use\": true, \"product_ids\": [], \"exclude_product_ids\": [], \"usage_limit\": \"\", \"usage_limit_per_user\": \"\", \"limit_usage_to_x_items\": \"\", \"expiry_date\": \"\", \"enable_free_shipping\": false, \"product_category_ids\": [], \"exclude_product_category_ids\": [], \"exclude_sale_items\": true, \"minimum_amount\": \"100.00\", \"maximum_amount\": \"0.00\", \"customer_emails\": [], \"description\": \"\\u05d0\\u05b1\\u05dc\\u05b9\\u05d4\\u05b4\\u0591\\u05d9\\u05dd\" } }";
var result = wc.UploadString(url, coupon);
return result;
Comment for this answer: Do you need the headers only or the body as well?
Comment for this answer: @uriz, have added the raw request headers and body to the answer
Comment for this answer: I have successfully create a new coupon with a Hebrew word in the description field using C# and the following library : https://gist.github.com/jakobt/b7400463e90e16928f57
Comment for this answer: Encoding the Hebrew string or sending as is both works, ensure to set the encoding on your WebClient object to UTF-8 . I have added the code.
Comment for this answer: it fails when i do it. I am doing it from .net env (C#)
Can you capture the raw request?
Comment for this answer: can you put the entire request (headers and body) so i can see what is wrong?
Comment for this answer: Did you encode the hebrew string or just sent it as is?  I am using the same library and it fails. Can you paste your code?
Comment for this answer: Ananad, this solved the problem (utf8 header of the web client). You saved me! thanks!

Here is another answer: Solution:
The problem solved by adding encoding to the WebClient.
It worked in English without the encoding, but once I used Hebrew text i got errors from the woocommerce API.
WebClient wc = new WebClient();
wc.Headers[HttpRequestHeader.ContentType] = "application/json";
wc.Encoding = Encoding.UTF8;

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 5, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:09/18/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<wordpress><woocommerce>', 'Title': 'Woocommerce create order with hebrew text using the api retuns an error', 'ViewCount': 656, 'id': 32650739, 'user_AboutMe': '', 'user_AccountId': 272632.0, 'user_DisplayName': 'uriz', 'user_Reputation': 555.0, 'user_Views': 81.0, 'user_id': 563823.0}}