Hi All,

I am trying to use this API using OAuth from my C++ .NET client.

How can get additional information about this error so that I can try
to fix it.

this->generateSignature();
        WebRequest^ myRequest = WebRequest::Create("http://twitter.com/
account/update_profile_background_image.xml");
        myRequest->Method = "POST";
        String^ boundary = this->CreateBoundary();
        myRequest->ContentType = "multipart/form-data; boundary=" + boundary;
        Encoding^ encoding = Encoding::ASCII;
        String^ requestString = L"--"+boundary+L"\r\n"+L"Content-Disposition:
form-data; name=\"image\"; filename=\"test.JPG\" " + L"\r\n"+L"Content-
Type: image/jpg"+L"\r\n\r\n";
        Stream^ requestStream = myRequest->GetRequestStream();
        requestStream->Write(encoding->GetBytes(requestString),0,encoding-
>GetBytes(requestString)->Length);
        FileInfo^ file = gcnew FileInfo(L"C:/Documents and Settings/vikramp/
My Documents/My Pictures/Picasa Exports/Picasa Export/test.JPG");
        FileStream^ myImage = file->OpenRead();
        array<Byte>^ ByteArray;
        if(myImage->CanRead)
        {
                ByteArray = gcnew array<Byte>(safe_cast<int>(myImage->Length));
                myImage->Read( ByteArray, 0,safe_cast<int>(myImage->Length));
                
requestStream->Write(ByteArray,0,safe_cast<int>(myImage->Length));
        }
        requestStream->Write( encoding->GetBytes(L"\r\n--" + boundary +
L"--"),0,encoding->GetBytes(L"--" + boundary + L"--")->Length);
        requestStream->Close();
        myImage->Close();
        Stream^ data = myRequest->GetResponse()->GetResponseStream();

Just in case some one needed the code.

All I am doing here signing the request with the default parameters
(image parameter no included).

The I write the multipart data.

Please help me out or direct me to a link which gives a information
about using the API.

Reply via email to