Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Accept : application/json

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top