Hi Alain,

We use jQuery with requests being authenticated through oAuth 2.0.

We had 2 (two) approaches when sending the request:
1. $.ajax
2. $.post

The data we sent was in one of the two formats:
- atom+xml
- json

Browsers used: Chrome and Firefox .

The four combination ($.ajax w/ json, $.ajax w/ atom+xml, $.post w/ json,
$.post w/ atom+xml) gave us a consistent result
oAuth 2.0 - experimental but very, very good


THE REQUEST
------------------------
 (for your convenience below are 2 requests: $.ajax & $.post , leading to
the same result as indicated)

1)
            $.ajax({
              type      :   'POST'
     ,
              url       :   "
https://www.google.com/m8/feeds/groups/default/full"; ,
              data      :   {   access_token  : THE_ACCESS_TOKEN  ,
                                alt           : "json"    ,
                                atom$entry    : {
                                                    xmlns               : "
http://www.w3.org/2005/Atom";,
                                                    xmlns$gd            : '
http://schemas.google.com/g/2005',
                                                    atom$category       : {

 scheme  : 'http://schemas.google.com/g/2005#kind'       ,

 term    : 'http://schemas.google.com/contact/2008#group'

 }, //atom$category
                                                    atom$title          : {

   type    : 'text',

   $t      : strGroupName

 },//atom$title
                                                    gd$extendedProperty : {

   name    : strExtended,

   info    : {

               $t : strGroupInfo

              }

 }//gd$extendedProperty
                                                }//atom$entry

                            },

              dataType      : 'jsonp'       , //returned type
              cache         : false         , //for 'script' and 'jsonp'
              crossDomain   : true          ,
              contentType   : 'application/json'    ,//contentType   :
'application/atom+xml' 'application/json'
              success       : function(pData, textStatus, jqXHR)
              {
                var pResponse = $.parseJSON(pData.feed);
                if($.isFunction(pCbkFunc)) pCbkFunc(1);
              },//success
              error : function(jqXHR, pData, errorThrown)
              {
                 if($.isFunction(pCbkFunc)) pCbkFunc(0);
              }
            });
         }

2)

    $.post("https://www.google.com/m8/feeds/groups/default/full";,
            {   access_token  : strToken  ,
                                alt           : "json"    ,
                                //v             : '3.0'     ,
                                atom$entry    : {
                                                    xmlns$gd            : '
http://schemas.google.com/g/2005',
                                                    atom$category       : {

 scheme  : 'http://schemas.google.com/g/2005#kind'       ,

 term    : 'http://schemas.google.com/contact/2008#group'

 }, //atom$category
                                                    atom$title          : {

   type    : 'text',

   $t      : strGroupName

 }
                                                }//atom$entry

              },
              function(pData)
              {
                    var pResponse = $.parseJSON(pData.feed);
                    if($.isFunction(pCbkFunc)) pCbkFunc(1);

              },
              'jsonp'

            );

THE RESPONSE
---------------------------
It is in JSON format, as requested.

https://www.google.com/m8/feeds/groups/default/full?callback=jQuery16107950585841575277_1317648211470&access_token=ya29.AHES6ZSUlxppuUDkdWNJPCYe7zIN34ysOokCfdy5Y9A_S8I&alt=json&v=3.0&atom%24entry%5Bxmlns%5D=http%3A%2F%2Fwww.w3.org%2F2005%2FAtom&atom%24entry%5Bxmlns%24gd%5D=http%3A%2F%2Fschemas.google.com%2Fg%2F2005&atom%24entry%5Batom%24category%5D%5Bscheme%5D=http%3A%2F%2Fschemas.google.com%2Fg%2F2005%23kind&atom%24entry%5Batom%24category%5D%5Bterm%5D=http%3A%2F%2Fschemas.google.com%2Fcontact%2F2008%23group&atom%24entry%5Batom%24title%5D%5Btype%5D=text&atom%24entry%5Batom%24title%5D%5B%24t%5D=Customer+Support&atom%24entry%5Bgd%24extendedProperty%5D%5Bname%5D=UnfoldingArt+&atom%24entry%5Bgd%24extendedProperty%5D%5Binfo%5D%5B%24t%5D=Various+Customer+Suport+Departments+you+can+contact&_=1317648243783

Response is 200.

-------
A couple of observations as far as the response is concerned:
-  When checking the account, no group is created
- The returned ID (feed.id) is the email rather then the group id.
- The group 'Title' is not what is supposed to be
---------

Many thanks for the prompt response

Bill









On Mon, Oct 3, 2011 at 3:05 AM, Alain Vongsouvanh <[email protected]> wrote:

> Hello Bill,
>
> If the group is not created, that would indicate that something went wrong
> during the request. Could you share with us the part of your code that
> inserts the group?
> Also, can you look at what is sent back by the API along with the 200
> status code?
>
> Thanks!
> Alain
>
>
> On Sun, Oct 2, 2011 at 5:41 AM, Bill Gilmore <[email protected]>wrote:
>
>> I try to create a group in contacts using JSONP, jQuery, oAuth 2.0
>>
>> Authorization OK, got access token, place call.
>>
>> I get a 'success' response in $.ajax and response code 200 rather then
>> 201.
>> Group however is not created.
>>
>> How should the response 200 be interpreted ?
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
>> To post to this group, send email to
>> [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://code.google.com/apis/contacts/community/forum.html
>>
>
>
>
> --
> Alain Vongsouvanh | Developer Programs Engineer
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://code.google.com/apis/contacts/community/forum.html
>

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to