[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FINALLY, a first test of Http_url_post_raw with Google Calendar. And there's a problem.



Hello,

I suspect you are reversing your log file excerpts.  The one that says 
"application/json" is coming from HTTPAPI, and the one that says 
"application/atom+xml" is coming from Google.

Why do I think that?  Because the one with "atom+xml" also says 
"GData-Version: 2.0", which is "Google Data Protocol", something I've 
never heard of until today.

I can only guess that you got the two samples mixed up.

The "content-type" field is somethign that YOU provide as a parameter to 
HTTPAPI.  If you omit that parameter, HTTPPAI will send 'text/xml' as a 
default (which isn't happening here.)

HTTPAPI makes no attempt to understand your data or "guess" at what the 
content-type would be.   Either you've told it to pass application/json 
(or application/atom+xml) or this isn't coming from HTTPAPI.  Believe 
me, it's not "trying to label it" for you.

-SK


On 1/27/2012 7:18 PM, James Lampert wrote:
> I'm getting back "HTTP/1.1 415 Unsupported Media Type." So I turned on
> debugging.
>
> Here is the transcript from a successful Post from Google's own OAuth
> Playground:
>
>> POST /calendar/feeds/default/private/full?alt=jsonc&xoauth_requestor_id=jamesl%40touchtonecorp.com HTTP/1.1
>> Host: www.google.com
>> Accept: */*
>> Authorization: OAuth oauth_version="1.0", oauth_nonce="8c54babfee27438fe5f554daf8a478e3", oauth_timestamp=  . . .
>> Content-Type: application/json
>> GData-Version: 2.0
>> Content-Length: 348
>>
>
> And here is what turned up in the HTTPAPI debug log:
>
>> POST /calendar/feeds/default/private/full?alt=jsonc&xoauth_requestor_id=jamesl%40touchtonecorp.com HTTP/1.1
>> Host: www.google.com
>> User-Agent: http-api/1.23
>> Content-Type: text/xml
>> Expect: 100-continue
>> Content-Length: 248
>> Accept: */*
>> Authorization: OAuth oauth_version="1.0", oauth_nonce="JAMESL00ssRABBITssss337002320000", oauth_timestamp= . . .
>> Content-Type: application/atom+xml
>> GData-Version: 2.0
>
>
> It looks like HTTPAPI is trying to label my JSON data stream as an ATOM
> data stream, and I need to tell HTTPAPI that the post data is JSON. Is
> there another call I don't know about, to set that up?
>
> --
> JHHL
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------