1

I am trying to implement Basecamp API in Android application. I am trying to rename the url from .xml extension to .json. It is working fine for some of the web services like peoples, Companies etc.

But when I try to get the json response of the particular company then it is giving me response in xml, though I am requesting for json.

like

String url =  "https://"+ domain +"/companies/" + companyId +".json"

and also Same for

"https://" + domain + "/projects/count.json".

Also I am trying to implement for below links it is not giving me result in json(is it giving blank response) but if I change the extension from .json to .xml then it is working fine for me and giving me response in XML

 1. "https://" + domain + "/projects/" + projectid +
    "/calendar_entries/milestones.json" 

 2. "https://" + domain + "/todo_lists.json?responsible_party=" + id

 3. "https://" + domain + "/projects/" + projectId +
    "/calendar_entries.json"

 4. "https://" + domain + "/projects/" + projectId +
    "/categories.xml?type=post"

I am using a Rest full API for connection with Restful web service.

I don't know why I am not getting json response from the web service.

Please help me out.

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
Dharmendra
  • 33,296
  • 22
  • 86
  • 129
  • need your help here http://stackoverflow.com/questions/13858098/login-to-new-basecamp-programatically-without-user-intervention – Kartik Domadiya Dec 14 '12 at 07:32

3 Answers3

1

Looking at their API docs, they don't seem to support JSON responses.

The Basecamp API is implemented as vanilla XML over HTTP using all four verbs (GET/POST/PUT/DELETE)

Some routes maybe returning json - probably they're working on json responses & is not rolled out yet. But the docs say it's XML, so you're stuck with XML for now.

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
  • But in the discussion http://groups.google.com/group/37signals-api/browse_thread/thread/edfbf31f61cae4e7.They supports some JSON request. – Dharmendra Feb 02 '12 at 12:33
  • @Dharmendra - "we make no guarantees about it". That pretty much sums up my answer too. – Sathyajith Bhat Feb 02 '12 at 12:41
  • SO Sathya What should I do, work with XML or JSON?I already implemented some services with JSON so Should I have to change them to XML ? – Dharmendra Feb 03 '12 at 03:38
  • @Dharmendra you should change to XML. Until and unless they officially announce json, I wouldn't use it because you never know when they'd make it stop. – Sathyajith Bhat Feb 03 '12 at 04:37
  • Yes that is the point.I should have to change the JSON to XML.Thanks for your help.:) – Dharmendra Feb 03 '12 at 08:37
0

You may try adding 'Accept' in the requests headers something like

Accept : application/json
user1163459
  • 128
  • 4
-1

It seems like you are using Basecamp Classic API which does not support JSON response.

The all-new Basecamp has all-new API supporting REST-style API that uses JSON for serialization and OAuth 2 for authentication. You can find it here (https://github.com/37signals/bcx-api).

Bharat Dodeja
  • 1,137
  • 16
  • 22