Roundup Tracker - Issues

Issue 2551168

classification
Undocumented search of a property in REST API
Type: behavior Severity: normal
Components: API Versions: devel
process
Status: new
:
: : rouilj, schlatterbeck
Priority: : rest

Created on 2021-11-08 17:32 by schlatterbeck, last changed 2021-12-07 07:49 by schlatterbeck.

Messages
msg7360 Author: [hidden] (schlatterbeck) Date: 2021-11-08 17:32
In a customer tracker we have a class 'opportunity' with the key 'opportunity_id'

Searching in the REST-API for (note the '/' separating the opportunity_id part)

.../rest/data/opportunity/opportunity_id=1234567

will retrieve the opportunity with the given ID and display it like the url ended in .../opportunity

This seems to be an undocumented feature. It *is* possible to search for .../opportunity/key where key would be the key of the class we search for (which is also currently undocumented as far as I can see). And I remember that for ambiguous cases (like this one) where the key is numeric that it was permitted to add the key property in the URL to allow searching for numeric keys.

What do we do with it?

Note that this doesn't just do a search like for issue:
.../rest/data/issue?title=just%20a%20test
will find some issues in my test-tracker while the same with a '/' won't find any. So this only works for key properties.

You can reproduce this with the standard schema with
.../rest/data/status/name=open
or
.../rest/data/status/open

I think this should be documented and tests be developed...

What do you think?
msg7361 Author: [hidden] (rouilj) Date: 2021-11-09 00:39
Hi Ralf:

In message <1636392735.95.0.682441672084.issue2551168@roundup.psfhosted.org>,
Ralf Schlatterbeck writes:
>What do we do with it?
>
>Note that this doesn't just do a search like for issue:
>.../rest/data/issue?title=just%20a%20test
>will find some issues in my test-tracker while the same with a '/'
>won't find any. So this only works for key properties.
>
>You can reproduce this with the standard schema with
>.../rest/data/status/name=open
>or
>.../rest/data/status/open
>
>I think this should be documented and tests be developed...

Isn't this the documentation for it:

  https://www.roundup-tracker.org/docs/rest.html#retrieve-item-using-key-value

We do warn that the short form (/data/status/open) doesn't work for
numbers (it's interprested as an id) and may not be supported in
future versions of the API.

>What do you think?

Testing yes. But I think it's already doc'ed (although I did forget
about that option).
msg7398 Author: [hidden] (rouilj) Date: 2021-12-07 04:55
Ralf, do you agree that this is documented and all we need is testing?
msg7400 Author: [hidden] (schlatterbeck) Date: 2021-12-07 07:49
Yes, I agree that this is well documented, seems I didn't find it immediately when I created this issue.
History
Date User Action Args
2021-12-07 07:49:53schlatterbecksetmessages: + msg7400
2021-12-07 04:55:13rouiljsetmessages: + msg7398
2021-11-09 00:39:03rouiljsetmessages: + msg7361
2021-11-08 17:32:15schlatterbeckcreate