TON API response header 400 without error message



I have just try to upload tailored audiences csv file by TON API, but got 400 response without error message.

twurl -t -H /1.1/ton/bucket/ta_partner -X POST -A “Content-Type: text/csv” --data “MY PRECIOUS BYTES"
opening connection to
starting SSL for
SSL established
<- “POST /1.1/ton/bucket/ta_partner HTTP/1.1\r\nContent-Type: text/csv\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: /\r\nUser-Agent: OAuth gem v0.5.1\r\nAuthorization: OAuth oauth_body_hash=”#AuthInfo”, oauth_consumer_key="#AuthInfo", oauth_nonce="#AuthInfo", oauth_signature="#AuthInfo", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1465966451”, oauth_token="#AuthInfo", oauth_version=“1.0”\r\nConnection: close\r\nHost:\r\nContent-Length: 17\r\n\r\n"
-> “HTTP/1.1 400 Bad Request\r\n”
-> “cache-control: no-cache\r\n”
-> “connection: close\r\n”
-> “content-length: 0\r\n”
-> “date: Wed, 15 Jun 2016 04:54:11 GMT\r\n”
-> “server: tsa_a\r\n”
-> “set-cookie: guest_id=v1%3A146596645164082436;; Path=/; Expires=Fri, 15-Jun-2018 04:54:11 UTC\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-connection-hash: 23cf64ea0f97db3f61264dfbbe9de94b\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-rate-limit-limit: 50\r\n”
-> “x-rate-limit-remaining: 45\r\n”
-> “x-rate-limit-reset: 1465966929\r\n”
-> “x-response-time: 9\r\n”
-> “x-tsa-request-body-time: 139\r\n”
-> "\r\n"
reading 0 bytes…
-> ""
read 0 bytes
Conn close

where I’m wrong ?


Hi @LeTung! You need to also send the header X-TON-Expires with a datetime value in RFC 2822 format, e.g. Thu, 21 Dec 2000 16:01:07 +0200 (in PHP, that’s date('r')), for when you want your file to expire. I use now + 1 day.


Note that the ta_partner bucket also requires the X-TON-Expires header to be set with an expiration date up to 7 days from the current date.


@majoritasdev yes, you are right.
also DATE_RFC1123 datetime value can be use too.

Thanks you