Home > Backend Development > Golang > Why is my SoftLayer Go SDK GET request failing to retrieve ItemCategory data?

Why is my SoftLayer Go SDK GET request failing to retrieve ItemCategory data?

DDD
Release: 2024-11-21 02:07:12
Original
562 people have browsed it

Why is my SoftLayer Go SDK GET request failing to retrieve ItemCategory data?

Unable to Retrieve ItemCategory Data in Go

When making a GET request to retrieve configuration information for a product package using the SoftLayer Go SDK, you may encounter an issue where the ItemCategory property is not populated, despite being specified in the object mask.

XMLRPC Endpoint Issue

The default SoftLayer endpoint for REST API calls is different from the one you are using, which appears to be XMLRPC. The presence of the "~/.softlayer" file may be causing the XMLRPC endpoint to be selected.

Resolution

To resolve this issue, switch the endpoint to the REST enpoint in your code.

Example

// Endpoint for RESTful API calls
endpoint := "https://api.softlayer.com/rest/v3"

// Create a new session with the REST endpoint
sess := session.New(username, apikey, endpoint)

// Get SoftLayer_Account service
service := services.GetProductPackageService(sess)

// Mask to get specific configuration properties
mask := "itemCategory"

// Call to retrieve configuration, including item category
result, err := service.Mask(mask).Id(257).GetConfiguration()
if err == nil {
    // ItemCategory data should now be available in the result object
}
Copy after login

The above is the detailed content of Why is my SoftLayer Go SDK GET request failing to retrieve ItemCategory data?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template