2016-07-06 39 views
0

我使用API​​订货SoftLayer的虚拟机。另外,设置用户元数据值。 我一直在使用“softlayer-api-client-0.2.2.jar”来调用各种AP​​I。的SoftLayer API错误 - setUserMetadata未实现

setUserMetadata是以前工作的罚款。但是自从几天以来它就失败了。 这个API最近改变了吗?上面的jar文件版本是否正确?

setUserMetadata API是给下面的错误 -

异常在线程 “线程2” com.softlayer.api.ApiException $内部:SoftLayer_Virtual_Guest_Strategy_Behavior_Standard :: setUserMetadata未实现(代码:SoftLayer_Exception_NotImplemented,状态:500)

请,帮助,使他们这个问题解决。谢谢!

回答

0

我的道歉,我能够通过SoftLayer API Client for Java设置用户的元数据,这里Java脚本,试试这个,让我知道,如果你继续遇到问题,请。确保使用客户端的主分支。

脚本:

package com.softlayer.api.VirtualGuest; 

import com.softlayer.api.ApiClient; 
import com.softlayer.api.RestApiClient; 
import com.softlayer.api.service.virtual.Guest; 
import java.util.ArrayList; 
import java.util.List; 
/** 
* This script sets the data that will be written to the configuration drive. 
* 
* Important Manual Page: 
* http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/setUserMetadata 
* 
* @license <http://sldn.softlayer.com/article/License> 
* @authon SoftLayer Technologies, Inc. <[email protected]> 
* @version 0.2.2 (master branch) 
*/ 
public class SetUserMetadata { 
    /** 
    * This is the constructor, is used to set user metadata   
    */ 
    public SetUserMetadata() { 
     // Declare your SoftLayer username and apiKey 
     String username = "set me"; 
     String apiKey = "set me"; 

     // Create client 
     ApiClient client = new RestApiClient().withCredentials(username, apiKey); 
     Guest.Service guestService = Guest.service(client, new Long(206659875)); 

     // Setting the medatada 
     String metadataTest = "test1RcvRcv"; 
     List<String> metadata = new ArrayList<String>(); 
     metadata.add(metadataTest); 

     try { 
      boolean result = guestService.setUserMetadata(metadata); 
     } catch (Exception e) { 
      System.out.println("Error: " + e); 
     } 
    } 

    /** 
    * This is the main method which makes use of SetUserMetadata method. 
    * 
    * @param args 
    * @return Nothing 
    */ 
    public static void main(String[] args) { 
     new SetUserMetadata(); 
    } 
} 

参考文献: