Json API Not Working But XML Is

I am trying to create a category, but consistently get an error when using the json API but not when using the xml API. I am basing my post off of your documentation at: http://developer.yahoo.com/social/rest_api_guide/categories-resource.html#category-ex_requests_post

Here is what I am posting: (I am using my real GUID but in this message have replaced it with {GUID})

URL: http://social.yahooapis.com/v1/user/{GUID}/categories?format=json
Content-Type: application/json
{"name" : "Family"}

And I get back the following error within the body and a 400 response.

{"error":{"uri":"http://www.yahooapis.com/v1/errors/400","lang":"en-US","description":"Request has malformed syntax or bad query","detail":"invalid format: category not found"}} 

Yet, if the only change I make is to use the XML API everything works. I use the exact same code for OAuth signing, connecting, everything.

 URL: http://social.yahooapis.com/v1/user/{GUID}/categories?format=xml
Content-Type: application/xml

It works like a champ. My code is not really geared to shift to an XML based API, I simply hard coded this simple example to see if the same problem I am having with json is happening with XML.

Any help would be greatly appreciated.

1 Reply
  • Well, I answered my own question. In digesting the error message I am seeing it made me wonder if your JSON API really wanted a wrapper around the category and wanted the wrapper to have the name category. You guys use this semantic in other RPC and YQL requests. So, sure enough, I changed the json that I am passing to the below and it worked.


    While I am happy that this is working, I am quite frustrated that I wasted hours chasing down an issue that was simply .. again .. how pathetic your documentation is. Seriously, don't you want developers using your APIs and accessing Yahoo? It is beyond ridiculous that you cannot even manage to get your documentation correct.


Recent Posts

in Contacts