How to access tests not at the root level via REST API
Hi.
While it partially works, I'm having trouble working out how to access some individual tests via the REST API.
I can see the list of tests when I hit taoTest/RestTests with only the Accept header. And I can retrieve an individual test whose parent is the root Test class by providing the uri header with the test's URI. But any that are further down in the hierarchy of classes (directories) that I try to retrieve in the same way simply return a 412 Precondition Failed status with the following payload:
{
"success": false,
"errorCode": 0,
"errorMsg": "One of the precondition for this type of request was not satisfied",
"version": "3.3.0-RC02"
}
I stepped through with xdebug and can see that it fails in class.CrudService.php's get() method where it checks $this->isInScope($uri), which seems to indicate that you cannot retrieve items that aren't at the root. Even the exception's message is "The URI must be a valid resource under the root Class".
So I have a couple of questions regarding using REST:
- Is it possible to retrieve items (tests, in this case) further down in the hierarchy?
- Is it possible to retrieve and/or manipulate the classes themselves?
- And is it possible to search for items by the values of their attributes?
I have tried a bunch of different things, read as many docs as I can find on the subject, but am unable to figure it out.
Currently using version 3.3.0-RC02.
Many thanks,
Nathan.
Comments
That is a bug you can patch around with this quickfix:
https://github.com/oat-sa/tao-core/compare/develop...fix/resource-retrieval
Thanks, Amy.
Looking at the comparison you provide, I can see that Tao Core (and Generis) is many version ahead from what is included in the 3.3 RC release (27.1.4 -> 38.13.0). Is this something I can apply to my current version?
I am currently running on docker from the 3.3.0-RC2 release in the oat-sa/package-tao repository. If this is very far behind should I be running something different to get the latest features?
That is a bug you can patch around with this quickfix:
https://github.com/oat-sa/tao-core/compare/develop...fix/resource-retrieval
Thanks Amy!