OData - Filter List method

  • 8 January 2020
  • 5 replies
  • 199 views

Badge +6

I am exploring the OData API to query system Smartobjects. 

 

For example /api/odata/v3/com_K2_System_Workflow_SmartObject_ProcSetPermissions needs a query parameter to indicate the ProcessSetID. 

 

What is the syntax to construct the URL for this? I tried a few things from the OData documentation but they all throw a HTTP 404 in the browser indicating that the URL is malformed.

 

Help? Thanks


5 replies

Badge +7

Hello  @VA1 ,

 

Please review the following paths and topics:

 

OData

https://help.k2.com/onlinehelp/k2blackpearl/userguide/4.7/default.htm#ServiceBrokers/K2ODataServiceBroker/K2ODataServiceBroker.htm

 

 

Configuring the SmartObject OData API

https://help.k2.com/onlinehelp/k2five/userguide/5.0/default.htm#K2_Management_Site/Integration/SmartObjectODataService.htm

 

 

SmartObject OData API

https://help.k2.com/onlinehelp/k2five/devref/5.0/default.htm#Runtime/SmO-OData/SmO-OData-service.htm

 

 

Configuring the SmartObject OData API

https://help.k2.com/onlinehelp/k2five/userguide/5.3/default.htm#K2-Management-Site/Integration/SmartObjectODataService.htm

 

All the best

   

 

 

 

 

 

Badge +6

Yes, I reviewed all that. The configuration is not my question, the syntax/usage is. I am unable to find any examples of using OData to execute List methods on K2 system smartobjects. Thanks

Badge +6

Hello  @VA1 ,


 


For a simple XML response from the list method of a particular SmartObject that is exposed through the OData API, you can just append the <atom:title> value for that SmartObject (e.g., I have a SmO named 'required' that is exposed through the OData API, with an <atom:title> value of 'requireds'. If I navigate to https://k2.denallix.com/api/odata/v3/requireds it will return XML of all values as if I were executing the 'Get List' method of the SmO).


 


Can you provide more information on how you are trying to consume data from the API?


 


Cheers,


qT


 


 


K2 will not accept any liability for any issues arising from actions taken in respect of information provided by any forum member.
Badge +6

I am not sure yet, I am just starting off by exploring the system data available in the com_k2_ set of smartobjects.

 

See attached. All I am trying to do is simulate what the Management site does in my screenshot i.e. run the List method for the SMO with a specific ProcSetID parameter


Hi VA1,

 

Have a look at the Odata documentation site

http://www.odata.org/documentation/odata-version-3-0/odata-version-3-0-core-protocol

and see an example of using a filter (see section 10.2.3.1)

 

I tried this with one of my own SmartObjects (AMSA_EMP) and viola! could filter it to a single record:

http://k2dev.server.com/api/odata/v3/AMSA_EMP?$filter=EMPNO eq '10018993' 

Result:

{
  "odata.count""1",
  "value": [
    {
      "EMPNO""10018993",
      "REPORTTO""3783382", ...
 
Another operator syntax to remember - very simlar to PowerShell...
 

I also tried this one - and it returned the top 10 records:

http://k2dev.server.com/api/odata/v3/AMSA_EMP?$top=10

 

You can also have a look at https://www.odata.org/documentation/odata-version-3-0/url-conventions/

 

It opens another rabbit-hole...

Bennie

 

 

 

 

Reply