问题描述
我正在使用的api调用是: https://api.softlayer .com/rest/v3/SoftLayer_Product_Package/257/getConfiguration 此调用返回的类型是Product_Package_Order_Configuration的数组: https://github.com/softlayer/softlayer- go/blob/master/datatypes/product.go#L1413
The api call I am using is: https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getConfigurationThe 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
我看到的问题是,在响应中,ItemCategory字段始终为nil.我没有使用口罩,所以我认为一切都应该退还.
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.
是否可以通过某种方式修改此调用以使其也返回ItemCategory?
Is there some way I can modify this call to have it return ItemCategory as well?
推荐答案
itemCategory是一个关系属性,它属于另一个数据类型,因此,如果要检索此数据,则需要在getConfiguration方法上使用对象掩码.
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/
您可以使用此rest api获取商品类别:
You can use this rest api to get the item categories:
方法:GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getConfiguration?objectMask=mask[itemCategory]
获取类别的另一种方法是通过同一服务的方法"getCategories".
Another way to get the categories is throuth the method "getCategories" of the same service.
您可以使用以下rest api:
You can use the following rest api:
方法:GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/257/getCategories
参考:
https://softlayer.github.io/reference/services/SoftLayer_Product_Package/getCategories/
这篇关于来自GetConfiguration的响应不会返回ItemCategory信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!