I am having problems trying to upload a hashed csv file to the TON endpoint. It works with TWURL:
e.g.
C:\Ruby22\bin>twurl -t -H ton.twitter.com /1.1/ton/bucket/ta_partner -X POST -A
"X-TON-Expires: Sat, 10 Nov 2015 23:01:50 GMT" -A “Content-Type: text/csv” -A
Content-Length: 0" --data “100000075”**
opening connection to ton.twitter.com:443…
opened
starting SSL for ton.twitter.com:443…
SSL established
<- “POST /1.1/ton/bucket/ta_partner HTTP/1.1\r\nX-Ton-Expires: Sat, 10 Nov 2015
23:01:50 GMT\r\nContent-Type: text/csv\r\nContent-Length: 9\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=“kNORTxFi3uo2MAdlIWiMxdRlRKY%3D
”, oauth_consumer_key=“XXXXXXXXXXXXXXX”, oauth_nonce=“PEYnSAIKjxxfH
KX3IXXXXXXXXXXXXXRVDXgMILbQ”, oauth_signature=“hBRYBHI%2FFdo%2FMer5xfNXFdlh
zTw%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1466785718”,
oauth_token=“9XXXXXXXXXXXXXXXXXYYYYYYYYYY”, oauth_versio
n=“1.0”\r\nConnection: close\r\nHost: ton.twitter.com\r\n\r\n”
<- “100000075”
-> “HTTP/1.1 201 Created\r\n”
-> “connection: close\r\n”
-> “content-length: 0\r\n”
-> “content-type: text/csv\r\n”
-> “date: Fri, 24 Jun 2016 16:28:40 GMT\r\n”
-> “location: /1.1/ton/data/ta_partner/ZZZZZZZZ/dOUl3wOD_sGzqL5.csv\r\n”
-> “server: tsa_b\r\n”
-> “set-cookie: guest_id=v1%3A146678572059484764; Domain=.twitter.com; Path=/; E
xpires=Sun, 24-Jun-2018 16:28:40 UTC\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-connection-hash: f4645c3fcb29e4d8b720cfb5417c07ae\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-rate-limit-limit: 50\r\n”
-> “x-rate-limit-remaining: 49\r\n”
-> “x-rate-limit-reset: 1466786620\r\n”
-> “x-response-time: 18\r\n”
-> “x-tsa-request-body-time: 2\r\n”
-> "\r\n"
reading 0 bytes…
-> ""
read 0 bytes
Conn close
HOWEVER
When I try to use the TON endpoint and pass in the CSV file, I get the following:
C:\Ruby22\bin>twurl -t -H ton.twitter.com /1.1/ton/bucket/ta_partner -X POST -A
"X-TON-Expires: Sat, 10 Nov 2015 23:01:50 GMT" -A “Content-Type: text/csv” -
** “Content-Length: 0” --file “c:\temp\test1_hashed.csv”**
opening connection to ton.twitter.com:443…
opened
starting SSL for ton.twitter.com:443…
SSL established
<- “POST /1.1/ton/bucket/ta_partner HTTP/1.1\r\nX-Ton-Expires: Sat, 10 Nov 2015
23:01:50 GMT\r\nContent-Type: multipart/form-data, boundary=“00Twurl5244367356
5691708lruwT99”\r\nContent-Length: 224\r\nAccept-Encoding: gzip;q=1.0,deflate;
=0.6,identity;q=0.3\r\nAccept: /\r\nUser-Agent: OAuth gem v0.5.1\r\nAuthoriza
ion: OAuth oauth_body_hash=“uFpxTawhQIBY2QFIGh9840O2IEk%3D”, oauth_consumer_k
y=“XXXXXXXXXXXXXXd”, oauth_nonce=“7UGS6V2bxVGW1BrnjM5iHNuOgqH9YNdO
FirLkainuU”, oauth_signature=“ljQONTMIZACy33sl7RcCLU7wlD8%3D”, oauth_signatu
e_method=“HMAC-SHA1”, oauth_timestamp=“1466785963”, oauth_token=“XXXXXXXX
YYYYYYYYYYYYYYYYYY”, oauth_version=“1.0”\r\nConnection
close\r\nHost: ton.twitter.com\r\n\r\n”
<- “–00Twurl524436735655691708lruwT99\r\nContent-Disposition: form-data; name=
“media[]”; filename=“test1_hashed.csv”\r\nContent-Type: application/octet-st
eam\r\n\r\njamie_maguire1\nsocialopinions\r\n–00Twurl524436735655691708lruwT99
-\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: Fri, 24 Jun 2016 16:32:45 GMT\r\n”
-> “server: tsa_b\r\n”
-> “set-cookie: guest_id=v1%3A146678596524229469; Domain=.twitter.com; Path=/;
xpires=Sun, 24-Jun-2018 16:32:45 UTC\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-connection-hash: 5383257478b4195796b5d47a383efc51\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-rate-limit-limit: 50\r\n”
-> “x-rate-limit-remaining: 48\r\n”
-> “x-rate-limit-reset: 1466786620\r\n”
-> “x-response-time: 13\r\n”
-> “x-tsa-request-body-time: 8\r\n”
-> "\r\n"
reading 0 bytes…
-> ""
read 0 bytes
Conn close
Can anyone please help?
Kind Regards.