inakiabt / etsy-php

Etsy API wrapper for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

got a 400, expected HTTP/1.1 20X or a redirect): Array ( ) Expected param 'tracking_code'

crystallove opened this issue · comments

I'm facing with the issue when use submitTracking method. I dont know why, because It works well when I get order information.

This is my code:

$request = array('params' => array(
'tracking_code' => $trackingcode,
'carrier_name' => $carriername,
'send_bcc' => false,
'shop_id' => $shopid,
'receipt_id' => $etsyreceipt

				));

$response = $GLOBALS['api']->submitTracking($request);

This is the error:
Fatal error: Uncaught Etsy\EtsyRequestException: [1]: Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect): Array ( ) Expected param 'tracking_code'.Array ( [http_code] => 400 [content_type] => text/plain;charset=UTF-8 [url] => https://openapi.etsy.com/v2/private/shops/xxxx/receipts/xxxx2/tracking?oauth_consumer_key=xxx&oauth_signature_method=HMAC-SHA1&oauth_nonce=xxxxx&oauth_timestamp=1500688376&oauth_version=1.0&oauth_token=xxxxx&oauth_signature=xxxx [header_size] => 920 [request_size] => 400 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.509848 [namelookup_time] => 0.0124 [connect_time] => 0.01332 [pretransfer_time] => 0.030961 [size_upload] => 0 [size_download] => 31 [speed_download] => 60 [speed_upload] => 0 [download_content_length] => 31 [upload_content_length] => 0 [starttran in public_html/etsy/src/Etsy/EtsyClient.php on line 67

I checked on tracking_code field. It was filled. I believe all require params are already there.

I really appreciate for any help,

why there is no answer :(
Maybe ETSY is not popular.
I tried with another method like
$tracking_url = 'https://openapi.etsy.com/v2/private/shops/'.$shopid.'/receipts/'.$receiptid.'/tracking'; $data = $client->oauth->fetch($tracking_url,$paramsent,OAUTH_HTTP_METHOD_POST,array('Content-Type' => 'application/x-www-form-urlencoded')); $json = $client->oauth->getLastResponse();

Above way also return the error:

object(OAuthException)#107 (9) { ["message":protected]=> string(73) "Invalid auth/bad request (got a 403, expected HTTP/1.1 20X or a redirect)" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(403) ["file":protected]=> string(57) "xxx/public_html/etsy/tracking.php" ["line":protected]=> int(75) ["trace":"Exception":private]=> array(1) { [0]=> array(6) { ["file"]=> string(57) "xxx/public_html/etsy/tracking.php" ["line"]=> int(75) ["function"]=> string(5) "fetch" ["class"]=> string(5) "OAuth" ["type"]=> string(2) "->" ["args"]=> array(4) { [0]=> string(79) "https://openapi.etsy.com/v2/private/shops/xxxx/receipts/xxxxxxx/tracking" [1]=> array(1) { ["params"]=> array(3) { [0]=> string(0) "" [1]=> string(22) "9400110898849000577676" [2]=> string(4) "usps" } } [2]=> string(4) "POST" [3]=> array(1) { ["Content-Type"]=> string(33) "application/x-www-form-urlencoded" } } } } ["previous":"Exception":private]=> NULL ["lastResponse"]=> string(407) "oauth_problem=signature_invalid&debug_sbs=POST&https%3A%2F%2Fopenapi.etsy.com%2Fv2%2Fprivate%2Fshops%2Fxxxx%2Freceipts%2Fxxx0%2Ftracking&oauth_consumer_key%3xxxd%26oauth_nonce%3Dxxxfa52.11725177%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1501056298%26oauth_token%3D1xxx9e1ce25%26oauth_version%3D1.0%26params%3Dusps" ["debugInfo"]=> NULL }

Any Update?

@crystallove Did you manage to solve that or have another workaround?

I am also having a problem creating a product on esty, "Invalid auth / bad request (got a 400, expected HTTP / 1.1 20X or a redirect)"
I think because I run the implementation in localhost with http so I can't post the data up