Response from GetConfiguration does not return ItemCategory information

我只是一个虾纸丫 提交于 2019-12-13 04:43:23

问题


The api call I am using is: https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getConfiguration The type returned from this call is an array of Product_Package_Order_Configuration: https://github.com/softlayer/softlayer-go/blob/master/datatypes/product.go#L1413

The issue I am seeing is that in the response, the ItemCategory field is always nil. I am not using a mask so I would think everything should be returned.

Is there some way I can modify this call to have it return ItemCategory as well?


回答1:


The itemCategory is a relational property and this belongs to another datatype, so you need to use object-masks over the getConfiguration method if you want to retrieve this data.

For more information you can see the following documentation:

https://softlayer.github.io/reference/datatypes/SoftLayer_Product_Package_Order_Configuration/

You can use this rest api to get the item categories:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getConfiguration?objectMask=mask[itemCategory]

Another way to get the categories is throuth the method "getCategories" of the same service.

You can use the following rest api:

Method: GET

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getCategories

Reference:

https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getCategories/


来源:https://stackoverflow.com/questions/50223233/response-from-getconfiguration-does-not-return-itemcategory-information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!