inakiabt / etsy-php

Etsy API wrapper for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Gzhuise opened this issue · comments

I am getting this error when submit tracking code through ETSY API :
Any help would be greatly appreciated !

Etsy\EtsyRequestException
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/xxxxxx/receipts/169999999/tracking?oauth_consumer_key=xxxxxxxx&oauth_signature_method=HMAC-SHA1&oauth_nonce=-xxxxxxxx&oauth_timestamp=1594779809&oauth_version=1.0&oauth_token=xxxxxxxx&oauth_signature=xxxxxxxx
[header_size] => 955
[request_size] => 403
[filetime] => -1
[ssl_verify_result] => 20
[redirect_count] => 0
[total_time] => 1.063
[namelookup_time] => 1.0E-6
[connect_time] => 0.219
[pretransfer_time] => 0.641
[size_upload] => 0
[size_download] => 31
[speed_download] => 29
[speed_upload] => 0
[download_content_length] => 31
[upload_content_length] => -1
[starttransfer_time] => 1.063
[redirect_time] => 0
[headers_recv] => HTTP/1.1 400 Bad Request
Connection: keep-alive
Content-Length: 31
Server: Apache
Set-Cookie: uaid=xxxxxxxx.; expires=Thu, 15-Jul-2021 02:10:31 GMT; Max-Age=31536000; path=/; domain=.etsy.com; secure
X-CLOUD-TRACE-CONTEXT: 2afb84d81257d72489a613e75de0b6a1/372768447438560266;o=0
X-Etsy-Request-Uuid: xxxxxxxx
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9449
X-Error-Detail: Expected param 'tracking_code'.
Cache-Control: private
Set-Cookie: user_prefs=xxxxxxxx.; expires=Thu, 15-Jul-2021 02:10:31 GMT; Max-Age=31536000; path=/; domain=.etsy.com
Content-Type: text/plain;charset=UTF-8
Via: 1.1 google
Accept-Ranges: bytes
Date: Wed, 15 Jul 2020 02:10:31 GMT
Via: 1.1 varnish
X-Served-By: cache-hkg17929-HKG
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1594779031.219571,VS0,VE214

)
.........
Caused by: OAuthException
Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect)

My action code :

$return = $this->api->submitTracking(array(
            'params' => array(
                "shop_id"=> "xxxxx",
	     "receipt_id"=> "16999999",				
               "tracking_code"=>"9400109202020999999999",
                "carrier_name"=> "4px",
            )));
print_r($return);

Hi Gzhuise,
You need to put post content in data index for post/put request. Please refer below code:

$return = $this->api->submitTracking(
       array(
            'params' => array(
                 "receipt_id"=> "16999999",	
            ),
           'data' => array(
                  "tracking_code"=>"9400109202020999999999",
                  "carrier_name"=> "4px",
            )
      )
);
print_r($return);

Please let me know if you need any help.

Thanks
Kshitij