Google Latitude JSON issue

nosaj66au

Member
Licensed User
Longtime User
Hi All hope someone can help. I have used the GmailContacts example as a base the modifiy the link loaction and scope to address Google Latitude. It works well Oauth good and the resopnse is as documented by google and I get my last location back. simple!!! However I should be able to return the responce data/format to update my location. however i get


{"error":{"errors":[{"domain":"global","reason":"parseError","message":"This API does not support parsing form-encoded input."}],"code":400,"message":"This API does not support parsing form-encoded input."}}

Here's the hacked code.
"m" contains the data from the first request and is "global scope".
Changed the Job done sub
B4X:
If HttpUtils.IsSuccess(url) Then
   Dim Parser As JSONParser
   Parser.Initialize(HttpUtils.GetString(url))
   Dim m , n As Map
   m = Parser.NextObject

The fist time a call the Lattitude I don't past any data this populates "m" it also sets "FirstTimeComplete" from then on I'm passing the data back....

Sub RequestContactsList
   ProgressDialogShow("Sending contacts list request...")
   Dim strTemp , tempst As String
   
   If FirstTimeComplete Then
      Dim JSONGenerator As JSONGenerator
      JSONGenerator.Initialize(m)
      strTemp = JSONGenerator.ToPrettyString(2) 
      
      HttpUtils.PostString("ContactList", LocationLink & "?access_token=" & AccessToken, strTemp) 
   Else
      HttpUtils.Download("ContactList", LocationLink & "?access_token=" & AccessToken)
      FirstTimeComplete = True
   End If
End Sub
Can anyone help
Jason
 
Last edited by a moderator:

nosaj66au

Member
Licensed User
Longtime User
Hi Again,
Looking at the API definition it must be something to do with "Content-Type: application/json" but it was my understanding JSON was default.

Here is the Def
_______________________________________________________________-
POST https://www.googleapis.com/latitude/v1/currentLocation?key=INSERT-YOUR-KEY
/* Authorization header here */
Content-Type: application/json

{
"data": {
"kind":"latitude#location",
"latitude":37.420352,
"longitude":-122.083389,
"accuracy":130,
"altitude":35
}
}

___________________________________________________-

They way it reads the /* Authorization header here */ is taken care of by using Oauth2.0

Any ideas

Thanks
Jason

I've tried to apply it in several method but is doesn't seem to fix the issue.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…