[Pulp-list] API: Consider to only return JSON parseable results

Jay Dobies jason.dobies at redhat.com
Wed Dec 7 16:59:08 UTC 2011


On 12/07/2011 11:52 AM, Peter Meier wrote:
> Hi all,
>
> Currently some actions on the API return results that are not parseable
> as JSON.
>
> For example the add_note or delete_note action on the repository. These
> actions return just the string "true", which is in my opinion a string
> that can not be parsed by JSON libraries. Actually, ruby's json can't
> parse it.
>
> It would make it easier for people working with the API, if they can
> count on it that if they get a 200 answer, that the body can be parsed
> as json.
>
> So for example these actions could return '{"result":true}', if they
> only would like to return true or false.
>
> What do you think?

100% agree. We're taking a much more REST-like approach with our APIs in 
the future (truth be told, the current ones are a bit sloppy) where all 
of the responses will be JSON parsable in the future.

> ~pete
>
> Btw: The documentation sometimes tells in that region that the result is
> Unspecified or "return: a Repo object". While this is not true for all
> actions, at least add_note returns "true" instead of a repo object.
> Should I file bzs?
>
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list


-- 
Jay Dobies
Freenode: jdob @ #pulp
http://pulpproject.org | http://blog.pulpproject.org




More information about the Pulp-list mailing list