2016-07-06 62 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(); 
    } 
} 

參考文獻: