35414

Mask and filter are not working when using the SoftLayer API

When I add billingItemFlag to my mask and filter it is missing in the results. I am using the SoftLayer-go api from the SoftLayer GitHub account. Is my filter or mask wrong?

Please consider the following code:

const mask string = "id;hostname;domain;billingItemFlag;billingItem" var filters = filter.Build( filter.Path("billingItemFlag").NotNull(), filter.Path("billingItem").NotNull(), ) accountService := services.GetAccountService(softlayerSession) hardware, err := accountService.Filter(filters).Mask(mask).Limit(1).GetHardware() if err != nil { panic(err) } println(hardware[0].BillingItemFlag)

The result of this code is "0x0" which is an invalid memory address.

When I enable debugging I can see the fields are not being returned but domain, hostname, and others are.

2018/02/17 11:08:08 ->>>Request: 2018/02/17 11:08:08 POST /xmlrpc/v3.1/SoftLayer_Account HTTP/1.1 Host: api.softlayer.com User-Agent: Go-http-client/1.1 Content-Length: 1875 Content-Type: text/xml Accept-Encoding: gzip <?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>getHardware</methodName><params><param><value><struct><member><name>headers</name><value><struct><member><name>User-Agent</name><value><string>softlayer-go/v0.1.0-alpha (go1.9.2;amd64;darwin)</string></value></member><member><name>authenticate</name><value><struct><member><name>username</name><value><string>REMOVED</string></value></member><member><name>apiKey</name><value><string>REMOVED</string></value></member></struct></value></member><member><name>SoftLayer_AccountObjectMask</name><value><struct><member><name>mask</name><value><struct><member><name>hostname</name><value><array><data></data></array></value></member><member><name>domain</name><value><array><data></data></array></value></member><member><name>billingItemFlag</name><value><array><data></data></array></value></member><member><name>billingItem</name><value><struct><member><name>recurringFee</name><value><array><data></data></array></value></member></struct></value></member><member><name>id</name><value><array><data></data></array></value></member></struct></value></member></struct></value></member><member><name>SoftLayer_AccountObjectFilter</name><value><struct><member><name>billingItem</name><value><struct><member><name>operation</name><value><string>not null</string></value></member></struct></value></member><member><name>billingItemFlag</name><value><struct><member><name>operation</name><value><string>not null</string></value></member></struct></value></member></struct></value></member><member><name>resultLimit</name><value><struct><member><name>limit</name><value><int>1</int></value></member><member><name>offset</name><value><int>0</int></value></member></struct></value></member></struct></value></member></struct></value></param></params></methodCall> 2018/02/17 11:08:09 <<<-Response: 2018/02/17 11:08:09 HTTP/1.1 200 OK Connection: close Cache-Control: private Content-Type: text/xml Date: Sat, 17 Feb 2018 16:08:08 GMT Ntcoent-Length: 3031 Server: Apache Softlayer-Total-Items: 402 Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN <?xml version="1.0" encoding="utf-8"?> <params> <param> <value> <struct> <member> <name>accountId</name> <value> <int>REMOVED</int> </value> </member> <member> <name>bareMetalInstanceFlag</name> <value> <int>0</int> </value> </member> <member> <name>domain</name> <value> <string>REMOVED</string> </value> </member> <member> <name>fullyQualifiedDomainName</name> <value> <string>REMOVED</string> </value> </member> <member> <name>hardwareStatusId</name> <value> <int>5</int> </value> </member> <member> <name>hostname</name> <value> <string>REMOVED</string> </value> </member> <member> <name>id</name> <value> <int>REMOVED</int> </value> </member> <member> <name>manufacturerSerialNumber</name> <value> <string>REMOVED</string> </value> </member> <member> <name>notes</name> <value> <string/> </value> </member> <member> <name>provisionDate</name> <value> <stringREMOVED</string> </value> </member> <member> <name>serialNumber</name> <value> <string> REMOVED</string> </value> </member> <member> <name>serviceProviderId</name> <value> <int>1</int> </value> </member> <member> <name>serviceProviderResourceId</name> <value> <string/> </value> </member> <member> <name>globalIdentifier</name> <value> <string> REMOVED </string> </value> </member> <member> <name>networkManagementIpAddress</name> <value> <string>1 REMOVED 0</string> </value> </member> <member> <name>primaryBackendIpAddress</name> <value> <string> REMOVED 4</string> </value> </member> <member> <name>primaryIpAddress</name> <value> <string> REMOVED </string> </value> </member> <member> <name>privateIpAddress</name> <value> <string> REMOVED</string> </value> </member> <member> <name>hardwareFunction</name> <value> <struct> <member> <name>code</name> <value> <string>WEBSVR</string> </value> </member> <member> <name>description</name> <value> <string>Web Server</string> </value> </member> <member> <name>id</name> <value> <int>3</int> </value> </member> </struct> </value> </member> <member> <name>hardwareStatus</name> <value> <struct> <member> <name>id</name> <value> <int>5</int> </value> </member> <member> <name>status</name> <value> <string>ACTIVE</string> </value> </member> </struct> </value> </member> </struct> </value> </param> </params>

Answer1:

The code you posted works when using the default endpoint or any other REST endpoint. It seems an issue from API, I recommend to switch to the default endpoint or use:

https://api.softlayer.com/rest/v3.1

Recommend

  • Softlayer filtering not working
  • Object Filter for Inovice create date
  • SoftLayer API: How to get advanced monitoring and firewall in the account from order billingId
  • Posting images via wp.uploadFile XML RPC
  • node.js passport session cookie domain
  • Create Invoice Method is not working properly of Magento API
  • Softlayer API: Account destroy?
  • Removing subscription to “Planned Maintenance” email notifications
  • Docker CentOS 7 - cron not working in local machine
  • fatal error: openssl/e_os2.h: No such file or directory
  • QBOv3 XML Validation Fault
  • How to get Apache XML-RPC 3.1.3 compliance (ISO date format along with time zone) in Java 1.6
  • How to resolve docker host names (/etc/hosts) in containers
  • How to resolve this packager error on react native Android
  • Are Richfaces and Primefaces compatible with each other?
  • Does CSS support inheritance [duplicate]
  • Eclipse MTJ doesn't see Java ME SDK 3.0 devices
  • Installing PHP 7 on digitalocean
  • PLSQL: Get number of records updated vs inserted when a merge statement is used
  • GAE: Way to get reference to an HttpSession from its ID?
  • How do I configure context broker accept post requests from my remote sensor?
  • saving file generated by TCPDF
  • JBoss External Properties Files in Classpath
  • Eloquent update method change created_at timestamp
  • Display images in Django
  • Mysterious problem with floating point in LISP - time axis generation
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • Get data from AJAX - How to
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • How do I fake an specific browser client when using Java's Net library?
  • How to limit post in wp_query
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • AngularJs get employee from factory
  • Free memory of cv::Mat loaded using FileStorage API
  • Memory offsets in inline assembly
  • need help with bizarre java.net.HttpURLConnection behavior
  • Turn off referential integrity in Derby? is it possible?
  • JaxB to read class hierarchy
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize