CMDBuild Forum

REST, how to use WsQueryOptions

In webservice manual it is stated:
"
Before version 3.3 many endpoints that managed lists of items had the possibility of specifying the
filter, limit, sort and other constraints to the output. To avoid listing every time all the different
parameters a new object called WsQueryOptions has been created to always include those
parameters. When the parameter “wsQueryOptions is specified for an endpoint it might be possible
to use the followings:
• attrs List of attributes to return
• filterStr A string containing a filter
• sort A string containing the sorting function
• limit A long value to limit the amount of results
• start A long value to set an offset in the resultset
• detailed A boolean to forse the server to return a detailed response
• positionOf A long value containing an id to return in the meta field
"

How to construct this parameter?
I tried:

data = {
‘WsQueryOptions’: {
‘attrs’: [‘Code’],
‘limit’: 1
}
}

and

data = {
‘attrs’: [‘code’],
‘limit’: 1
}

and than python’s requests.get(endpoint, headers=self._headers, data=json_data).json()
but with no success.

Who tu use WsQueryOptions properly?

2 Likes

PLease I have the same problem

Hi,
I would also be interested in this, I can’t see anything about this in the manuals.

If you find a solution tell me

Hi!

You have this post than can help you, search the 5004 or words " REST, how to use WsQueryOptions" in the forum

You need to send the second data that you tried as “params” ( not data ) in python request function.

data = {
‘attrs’: [‘Code’],
‘limit’: 1
}

and than python’s requests.get(endpoint, headers=self._headers, params=params).json()