Filtering columns from REST response V1 or V2 API
Hi,
I'm trying to figure out how I can significantly filter the results returned by a nodes/{id}/nodes REST GET request so that I can get just the ID and NAME of each child. When I try to do it with the v1 version of the API, I cannot get the format right and end up with an empty list. When I try to do it with the v2 version of the API, no filter I apply has any effect.
The V2 API returns the following immediate children: links, collection, and results. First off, I'm uninterested in links, so would like to eliminate that entirely. I tried appending &fields=results&fields=collection to my query and it had no effect.
I'm partially interested in the collection child only because it has information on pagination that may or may not have occurred.
The goal though is I want to eliminate most of what I don't need in order to get at what I do need. Can anyone give me an example of how you'd filter your results from GET cs.exe/api/v[1|2]/nodes/{id}/nodes ? V1 or V2 would be fine so long as I get one that works.
Thanks in advance
-Hugh
Comments
-
api/v2/nodes/{id}/nodes?fields=properties{id,name} would accomplish that but I don't think you can eliminate links.
Have you seen the Knowledge Centers API docs?
0 -
Specifically the implementation notes expanded section in the API docs.
0 -
Hi Matthew,
I have been going off the documentaiton at developer.opentext.com because I know where to find it there. That documentation is similar to the documentation you referenced except it doesn't have complete implementation notes.The right thing is to pass in fields=properties{id,name} and it works, but how would I know to do that with a JSON structure that is:
collections --->
links -->
results [
{data : {properties : {id, name, etc...}
What is implied in the example is that to limit the properties contained within results-->data-->properties, you pass in properties{id,name}Does the fields parameter assume that it is to take effect only if your JSON response contains results-->data-->properties? What are the limitations of this parameter? I might have an answer tomorrow as I'm working from home and will have access to CSIDE.
-Hugh0 -
Yes, by default you get everything but in practice you should only ask for what you want. You will get performance improvements if you do (i.e. we don't have to pull version information or RM info etc.)
The fields parameter can be used on the "field groups" under results[ i ].data
ex.
api/v2/nodes/2000/nodes?fields=properties{name,id}&fields=versions{mime_type}&fields=favorites{name}
The limitations are that this is a v2 thing only. The nodes resource and the things below node/id, nodes/id/nodes etc. work but I haven't tried the various other v2 calls.0 -
Matthew_Pinkney said:
...The fields parameter can be used on the "field groups" under results[ i ].data
ex.
api/v2/nodes/2000/nodes?fields=properties{name,id}&fields=versions{mime_type}&fields=favorites{name}
The limitations are that this is a v2 thing only. The nodes resource and the things below node/id, nodes/id/nodes etc. work but I haven't tried the various other v2 calls.Well i have a similar challenge. I am searching for a way to filter my results in a Connected Workspaces REST API 16.2 scenario.
But this is not working when i am using the Connected Workspaces REST API 16.2 documentation in the scenario.My GET Call:
api/v2/businessworkspaces/15497591/relateditems?fields=related_items{id, parent_id}
But as a result it returns me a json file with more than 1000 lines.
@Matthew_Pinkney or anyone else, any ideas why ?
Cheers Mchoeti
0 -
have you traced the call on the OScript side to see what its doing with the parameters you pass, perhaps the fields parameter is not supported at all / in the same way ?
0 -
I did get it to work but only in the context of the results object that is returned. All the other top level JSON objects like links are not impeded. Using Oscript might help me understand the root of the problem but on this project I'm powerless to use any of my Oscript Kung Fu.
-Hugh0 -
Hi Hugh,
I just want to filter the results block. So that would be sufficient.
The results block looks like this:
In the properties I just want to have the attributes id, name and parent_id instead of the long list of attributes.
Do you have an example for me of how you filtered these attributes in the results block?
Thanks,
Gerhard0 -
Greg Griffiths said:
have you traced the call on the OScript side to see what its doing with the parameters you pass, perhaps the fields parameter is not supported at all / in the same way ?
@Hugh Ferguson Would be really nice if you have an example. I am looking for a way to solve this without Oscript KungFu
All the best stay save and have a wonderful weeking. Looking forward to hear from you soon.
Cheers Christian0 -
Hi Mchoeti,An example how to use the Connected Workspaces REST API can be found here: https://appworksdeveloper.opentext.com/webaccess/#url=/awd/blogs/30560823/connected+workspaces+ndash+using+the+rest+api&tab=501Regarding the business workspaces call:- Some base properties are always returned- You need to pass the action parameter "&action=properties-properties" that the returned properties are restricted
- Do you restrict the number of returned results via "limit" and "page"?For example to get 10 related child workspaces (having workspace type id 3) for workspace 15497591:api/v2/businessworkspaces/15497591/relateditems?fields=properties{wnf_wksp_type_id}&limit=10&page=1&sort=name&where_relationtype=child&where_workspace_type_id=3&action=properties-propertiesRegards,Alex0
Categories
- All Categories
- 122 Developer Announcements
- 53 Articles
- 149 General Questions
- 148 Thrust Services
- 56 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 917 Cloud Fax and Notifications
- 84 Digital Asset Management
- 9.4K Documentum
- 31 eDOCS
- 181 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories