IBM Support

How to use the REST API Get method paramaters: _includecols and _excludecols in the REST API URL?

Technical Blog Post


Abstract

How to use the REST API Get method paramaters: _includecols and _excludecols in the REST API URL?

Body

Question:
Why I am not able to use the REST API Get method paramaters: _includecols and _excludecols in the REST API URL?

 

You might have tried to use the GET method of REST API parameter below. But, you are not able to achieve the desired result using them:
 _includecols and _excludecols

The URL used similar with the below one.                                                         
http://hostname:port/maxrest/rest/os/MXASSET?_includecols=assetnum,serialnum                                                
                                                                       
It returns all the attributes.  

Answer:
Please be aware that the _includecols and _excludecols parameters of the GET Method of the REST API are ONLY valid for a business object resource

(maxrest/rest/mbo/).
That is, these parameters can not be used for Maximo Integration Framework (MIF) object structure (maxrest/rest/os/).
As you use these parameters with the MIF object structure, that is why it does not work for you.

If you use the below URL, it should work for you:
http://hostname:port/maxrest/rest/mbo/asset?_includecols=assetnum,serialnum

 

Please read the document in the below link for details and samples.    
http://www-

01.ibm.com/support/knowledgecenter/SSLKT6_7.6.0/com.ibm.mt.doc_7.6.0/gp_intfrmwk/rest_api/c_rest_includecols_excludecols_param.html?lang=en    

 

[{"Business Unit":{"code":"BU005","label":"IoT"}, "Product":{"code":"SSLKT6","label":"Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]

UID

ibm11131633