0

File Transfer API

Hello,

I am using file transfer API.I am getting same error.Even all credentials are correct.

[Code]
string f_transfer_sessionId= Guid.NewGuid().ToString();
string path=@"e:\test.txt";
string sendFile_realm = "rcore1.messenger.yahooapis.com/v1/filetransfer/relay";
string url = "http://" + sendFile_realm + "?&sid=" + sessionId + "&oauth_consumer_key=" + oauth_consumer_key + "&oauth_signature_method=" +
oauth_signature_method + "&oauth_nonce=" + oauth_nonce + "&oauth_timestamp=" + oauth_timestamp + "&oauth_signature=" + oauth_signature
+ "&oauth_version=" + oauth_version + "&oauth_token=" + oauth_token;

string postdata = "{\"sendAs\":\"yadavmamta02\",\"action\":\"invite\",\"ftSessionId\":\"" + f_transfer_sessionId+ "\" ,\"target\":\"sharmarekha786\":
[{\"files\":{\"fileName\":\"" + path + "\",\"fileSize\":363}}]}";[Code]


Error:-The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse()

Please help me.

Thanks
Mamta

by
14 Replies
  • Can you post the entire HTTP request. The information you have provided looks alright. There could be other reasons for the failure, which would be more evident once we see the HTTP packets.

    QUOTE (Mamta Yadav @ Sep 20 2010, 05:18 AM) <{POST_SNAPBACK}>
    Hello,

    I am using file transfer API.I am getting same error.Even all credentials are correct.

    [Code]
    string f_transfer_sessionId= Guid.NewGuid().ToString();
    string path=@"e:\test.txt";
    string sendFile_realm = "rcore1.messenger.yahooapis.com/v1/filetransfer/relay";
    string url = "http://" + sendFile_realm + "?&sid=" + sessionId + "&oauth_consumer_key=" + oauth_consumer_key + "&oauth_signature_method=" +
    oauth_signature_method + "&oauth_nonce=" + oauth_nonce + "&oauth_timestamp=" + oauth_timestamp + "&oauth_signature=" + oauth_signature
    + "&oauth_version=" + oauth_version + "&oauth_token=" + oauth_token;

    string postdata = "{\"sendAs\":\"yadavmamta02\",\"action\":\"invite\",\"ftSessionId\":\"" + f_transfer_sessionId+ "\" ,\"target\":\"sharmarekha786\":
    [{\"files\":{\"fileName\":\"" + path + "\",\"fileSize\":363}}]}";[Code]


    Error:-The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse()

    Please help me.

    Thanks
    Mamta
    0
  • Even i am facing the same error.

    Please find the request/response that i am doing, and let me know what wrong i am doing.


    Request:

    CODE
    POST http://rcore1.messenger.yahooapis.com/v1/filetransfer/relay?oauth_consumer_key=STRIPPED&oauth_nonce=8fbeb9ab-6ab7-41a8-bf28-aab1afce02d8&oauth_signature=STRIPPED&oauth_signature_method=PLAINTEXT&oauth_timestamp=1297014473&oauth_token=A%3DGzDK662R5zvkUDRNl.ahPQASAU06xiv3hJZwuR9fXK0qpm8EfIQijoh96vsoW9NzWaN6yAXV59VhbY
    MrXKU5FKRKe3NlBuUSmQQJW6lZreEKEU2wIbmI0dFIBohlC9CEKizR7LLNaERP_S05lz_8rNhb3f.MU8i
    zNGTqmrXwkLyeCpcrcAuS_8VLa5ZETE0LbRX59zbvk2PQxmKbQVX6lAeNabw57WpkjRUkyHRXe_qIsDYF
    Naz9Ac99UCrJ2QqS85WWOBrodl6RBO2dPAeFvJyBv0NRjwGDFNUx_GC.Zo2o_Vwf4HVuly_L0e1j3Ar.2
    3zjknarcka7e9rzL0VZXqgmAH6iUszlVWH46ivsOxVHPszM7eGqpwggl6AWTqoEx9T.iO_rRnUm.fmfj0
    A_iz9bBZZqt0T1j4Drh1jugdsiwFgMi3.NRIoyotrtDqhhn2FMFcWZs04PemYDQraPszDJlfztObVWfI3
    4ytwfDJWimVg7lRnLDJKHo9M.sgzbMZ8y1QKdMwadRTj.fDVpbMSx5.2kbDqEzK_a2CdEfyKgrlIQ4mpm
    JJt3y9tKFTh3Oun3IlyIrGbQmkvUa1epboKM0qMcJQHak.GdtTLBy1vbHzxaugFy7n5wfYzfoa8PX6kwi
    kfw9IzIstAb_po93ulNlgKUD.SJ9xJ63CH395GWjch1DsYDs4qbCFdr5W2sbR_r25_LEi.kboQ8MqCh38
    vLMDYq6R0zGDVc1o.UBxBDbn5zbR.NZUYID2wKaQKEta2eJXffJClFKvp4021IlQTzJHS94K.vIkBnTQ2
    CNfQy&oauth_version=1.0&sid=v2hChWPs3RN1VPOCOv3iEZDLv3p764g5fir9EQ-- HTTP/1.1
    Content-Type: application/json; charset=utf-8
    Host: rcore1.messenger.yahooapis.com
    Content-Length: 146
    Expect: 100-continue

    {"sendAs":"vrindirnd","action":"invite","ftSessionId":"FILE-TO-TRANSFER","target":"patelharshilb","files":[{"fileName":"file.xml","fileSize":65}]}



    Response:
    CODE
    HTTP/1.1 403 Forbidden
    Date: Sun, 06 Feb 2011 17:46:19 GMT
    P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
    cache-control: public,must-revalidate
    content-length: 110
    content-type: application/json;charset=utf-8
    Vary: Accept-Encoding
    Connection: close

    {"error":{"code":-1009,"detail":"Capability Check Error","description":"Capability Check Error"},"code":-1009}
    0
  • QUOTE (Harshil Patel @ Feb 6 2011, 09:52 AM) <{POST_SNAPBACK}>
    Even i am facing the same error.

    Please find the request/response that i am doing, and let me know what wrong i am doing.


    Request:

    CODE
    POST http://rcore1.messenger.yahooapis.com/v1/filetransfer/relay?oauth_consumer_key=STRIPPED&oauth_nonce=8fbeb9ab-6ab7-41a8-bf28-aab1afce02d8&oauth_signature=STRIPPED&oauth_signature_method=PLAINTEXT&oauth_timestamp=1297014473&oauth_token=A%3DGzDK662R5zvkUDRNl.ahPQASAU06xiv3hJZwuR9fXK0qpm8EfIQijoh96vsoW9NzWaN6yAXV59VhbY
    MrXKU5FKRKe3NlBuUSmQQJW6lZreEKEU2wIbmI0dFIBohlC9CEKizR7LLNaERP_S05lz_8rNhb3f.MU8
    i
    zNGTqmrXwkLyeCpcrcAuS_8VLa5ZETE0LbRX59zbvk2PQxmKbQVX6lAeNabw57WpkjRUkyHRXe_qIsDY
    F
    Naz9Ac99UCrJ2QqS85WWOBrodl6RBO2dPAeFvJyBv0NRjwGDFNUx_GC.Zo2o_Vwf4HVuly_L0e1j3Ar.
    2
    3zjknarcka7e9rzL0VZXqgmAH6iUszlVWH46ivsOxVHPszM7eGqpwggl6AWTqoEx9T.iO_rRnUm.fmfj
    0
    A_iz9bBZZqt0T1j4Drh1jugdsiwFgMi3.NRIoyotrtDqhhn2FMFcWZs04PemYDQraPszDJlfztObVWfI
    3
    4ytwfDJWimVg7lRnLDJKHo9M.sgzbMZ8y1QKdMwadRTj.fDVpbMSx5.2kbDqEzK_a2CdEfyKgrlIQ4mp
    m
    JJt3y9tKFTh3Oun3IlyIrGbQmkvUa1epboKM0qMcJQHak.GdtTLBy1vbHzxaugFy7n5wfYzfoa8PX6kw
    i
    kfw9IzIstAb_po93ulNlgKUD.SJ9xJ63CH395GWjch1DsYDs4qbCFdr5W2sbR_r25_LEi.kboQ8MqCh3
    8
    vLMDYq6R0zGDVc1o.UBxBDbn5zbR.NZUYID2wKaQKEta2eJXffJClFKvp4021IlQTzJHS94K.vIkBnTQ
    2
    CNfQy&oauth_version=1.0&sid=v2hChWPs3RN1VPOCOv3iEZDLv3p764g5fir9EQ-- HTTP/1.1
    Content-Type: application/json; charset=utf-8
    Host: rcore1.messenger.yahooapis.com
    Content-Length: 146
    Expect: 100-continue

    {"sendAs":"vrindirnd","action":"invite","ftSessionId":"FILE-TO-TRANSFER","target":"patelharshilb","files":[{"fileName":"file.xml","fileSize":65}]}



    Response:
    CODE
    HTTP/1.1 403 Forbidden
    Date: Sun, 06 Feb 2011 17:46:19 GMT
    P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
    cache-control: public,must-revalidate
    content-length: 110
    content-type: application/json;charset=utf-8
    Vary: Accept-Encoding
    Connection: close

    {"error":{"code":-1009,"detail":"Capability Check Error","description":"Capability Check Error"},"code":-1009}


    Hi,
    Can you confirm that you submitted the clientCapability value of 'fileXfer' during login (POST /v1/session) ?
    0
  • do you know what is wrong? i got the same problem....
    0
  • i don;t have session_managenet function.
    I have v1/session in sign_on function. ( where yes, i can put clientcapability ).
    can you please give me an example? I still have error 400 from fttp response.
    0
  • me too..having the same pb
    0
  • Hello,

    Try this code for giving clientCapabilities.
    string sessions_realm = "developer.messenger.yahooapis.com/v1/session";
    string postdatas = "{\"presenceState\":0,\"presenceMessage\":\"my login status message\",\"clientCapabilities\":[{\"clientCapability\":\"fileXfer\"}]}";//,\"fileSize\":300
    string urls = "http://" + sessions_realm + "?&oauth_consumer_key=" + oauth_consumer_key + "&oauth_signature_method=" + oauth_signature_method +
    "&oauth_nonce=" + oauth_nonce + "&oauth_timestamp=" + oauth_timestamp + "&oauth_signature=" + oauth_signature + "&oauth_version=" +
    oauth_version + "&oauth_token=" + oauth_token;//+ "&notifyServerToken=" +
    string fileSessionId_request = fetchURL(urls, true, postdatas);

    Thanks



    QUOTE (Maria @ Feb 27 2011, 12:48 PM) <{POST_SNAPBACK}>
    i don;t have session_managenet function.
    I have v1/session in sign_on function. ( where yes, i can put clientcapability ).
    can you please give me an example? I still have error 400 from fttp response.
    0
  • and the fileSessionId_request = fetchURL(urls, true, postdatas) I obtain i use in this postdata and path is the path of the file

    string postdata = "{\"sendAs\":\"cccccc",\"action\":\"invite\",\"ftSessionId\":\"" +fileSessionId_request + "\" ,\"target\":\"person_target\":[{\"files\":{\"fileName\":\"" + path + "\",\"fileSize\":1143}}]}";

    no?

    Thank you very much
    0
  • i still have error 400 at webresponse...:(...what am I doing wrong?
    0
  • how can I obtain relay IP whe using action send? relay i is the relay server IP: 98.136.56.75 ?
    3.Authorization: < Standard OAuth credentials >
    4.Host: 98.136.56.75
    0
  • Hello,

    We obtain relayIp by the following way.

    string howtogeek = "ftrelay.messenger.yahooapis.com";
    IPAddress[] addresslist = Dns.GetHostAddresses(howtogeek);
    relayIP = addresslist[0].ToString();

    Thanks




    QUOTE (developer @ Mar 2 2011, 04:19 AM) <{POST_SNAPBACK}>
    how can I obtain relay IP whe using action send? relay i is the relay server IP: 98.136.56.75 ?
    3.Authorization: < Standard OAuth credentials >
    4.Host: 98.136.56.75
    0
  • Hello,

    Your post data syntax is in correct,that's why you are getting this error(400).
    Try the following syntax.

    string postdata = "{\"sendAs\":\"" + iPrimaryLoginID + "\",\"action\":\"invite\",\"ftSessionId\":\"" + sessionID + "\",\"target\":\"" + aYahooContactID + "\",\"files\":[{\"fileName\":\"" + filename + "\",\"fileSize\":" + size + "}]}";

    Thanks


    QUOTE (developer @ Feb 28 2011, 01:35 AM) <{POST_SNAPBACK}>
    i still have error 400 at webresponse...:(...what am I doing wrong?
    0
  • I already resolved that problem, thank you.
    How can I get relay IP in order to do action: send a file
    0
  • could you describe me the steps of implementing send file after obtaining filetransfer invite?
    0

Recent Posts

in Messenger IM SDK