At this point in the script I have obtained a valid Auth token using
the Client Login process and I am passing a valid string that is of
type "text/tab-separated-values"

If you need to see other code please let me know.

Thanks for the help

function upload2GDocs(authToken, content){
    //function used to upload the content to GDocs

/* I have tried with and without the ?v=2 parameter */
    var gdocURL = 'http://docs.google.com/feeds/documents/private/
full';

    //unsafeWindow.console.log(content);

        authToken = authToken.toString();
    if (authToken.length > 1) {
        GM_xmlhttpRequest({
            method: 'POST',
            url: gdocURL,
                        overrideMimeType: "text/tab-separated-values",
            headers: {
                                'Authorization': 'GoogleLogin ' + authToken,
                        'Content-Length': content.length,
                                //'Content-Type': 'text/csv',
                'Content-Type': 'text/tab-separated-values',
                'Slug': download_report_ref+'.csv'

            },
            data: content,
            onreadystatechange: function(responseDetails){
                        //unsafeWindow.console.log(responseDetails.readyState);
            },
            onload: function(responseDetails){
                        unsafeWindow.console.log(responseDetails.status + ': '+
responseDetails.statusText);
                        
//unsafeWindow.console.log(responseDetails.responseHeaders);
                        unsafeWindow.console.log(responseDetails.responseText);
                //wait till the file is downloaded, and execute this
when ready
                if (responseDetails.status == 201) {
                    var ans = confirm('Successfully uploaded to Google
Docs \nFilename: ' + download_report_ref + '\n\n Click OK to open
Google Docs in a new tab \n\n(you must allow popups from www.google.com)');
                    if (ans) {
                        window.open("http://docs.google.com/#all";,
'external');
                    }

                }
                else {
                    //unsafeWindow.console.log
(responseDetails.responseHeaders);
                    //unsafeWindow.console.log
(responseDetails.responseText);
                    if (responseDetails.status == 400) {
                        retryLessWin(responseDetails);
                    }
                    else {
                        alert('Whoops! There was a problem \n\n
Error: ' + responseDetails.status + ': ' +
responseDetails.statusText);
                    };
                                    };

                showLoad(false);
            },
            onerror: function(responseDetails){
                alert('There seems to be a problem connecting...\n' +
responseDetails.status + ': ' + responseDetails.statusText);
                showLoad(false);
            }

        });


    }

}

On Jul 17, 7:45 pm, Eric Bidelman <api.e...@google.com> wrote:
> Can I see the code?
>
>
>
> On Fri, Jul 17, 2009 at 4:13 AM, Spanishgringo <freeman...@gmail.com> wrote:
>
> > I have a script that I have been using for the last year to export
> > reports directly from Google Analytics to Google Docs & Spreadsheets.
>
> > Something seems to have changed on the Google Docs Data List API side
> > where I always get a 415 error.  I am using Greasemonkey with
> > ClientLogin Auth and xmlhttpRequest to submit the downloaded csv or
> > tsv file.
>
> > The response text with the 415 error is:
>
> > Content-Type text/csv;charset=utf-8 is not a valid input type.
>
> > Any ideas?
>
> > Please help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to