Re: REST-API: Show retired status

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi Ralf:

In message <[email protected]>,
Ralf Schlatterbeck writes:
>As some of you may be aware, when an item is retired in the database
>it is still shown in the REST API (and in the item template in the
>normal web-interface). I'm thinking about adding an additional
>attribute in the web-interface. We currently have:
>
>.../rest/data/issue/1
>
>{ 'link': '.../issue/1'
>, '@etag':
>, 'type': 'issue'
>, 'id': '1'
>, 'attributes' : {
>  ...
>  }
>}
>
>I'd like to add in the outer dictionary a 'retired': True/False
>flag, what do you think? The main use-case here is to quickly
>see that a delete via REST (resulting in a retire in the API)
>was successful.

Well the delete rest call will return a 2xx for success or a 4xx for
error. So that tells you if the cal worked.

IIRC a .../rest/data/issue request won't show a retired issue?  Does
.../rest/data/issue?id=1 return only issue1 in the collection or does
it return an empty collection? I think the latter. So getting an empty
collection, you have achieved your goal. It does require a search
rather than a direct lookup (so not quite so quickly a check).

If it is not done often, maybe we don't have to optimize for the case.
The id field is the key it should be indexed for fast lookup anyway,
so the search may not be any slower/faster than issue/1.

If you decide we do need a field,

>Is 'retired' the correct name? Or something like 'deleted'
>to reflect the names in the REST API?

I would say retired as that is the state of the entry. DELETE is the
HTTP verb that changes the retired state or the operator that again
changes the state.

Have a great weekend.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.