2017-04-20 57 views
0

我試圖使用其餘api提供的配置架構。我在執行給定的curl命令時遇到以下錯誤。請幫忙。 對不起,我不得不掩蓋一些信息。Kaa - 無法使用REST api創建配置架構

C:\xxxx>curl -v -S -u test:test123 -F'configuration 
Schema={"applicationId":"32768","name":"Test configuration schema","description" 
:"Configuration Schema Description"};type=application/json' -F [email protected] 
onschema.json "http://xx.xx.xx.xx:8080/kaaAdmin/rest/api/configurationSchema" 
| python -mjson.tool 
* Trying xx.xx.xx.xx... 
* TCP_NODELAY set 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0* 
Connected to xx.xx.xx.xx (xx.xx.xxx.xx) port 8080 (#0) 
* Server auth using Basic with user 'test' 
* WARNING: Using weak random seed 
> POST /kaaAdmin/rest/api/configurationSchema HTTP/1.1 
> Host: xx.xx.xx.xx:8080 
> Authorization: Basic c3JlZTp0ZXN0MTIz 
> User-Agent: curl/7.53.1 
> Accept: */* 
> Content-Length: 750 
> Expect: 100-continue 
> Content-Type: multipart/form-data; boundary=------------------------df9c304eed 
a5285e 
> 
    0 750 0  0 0  0  0  0 --:--:-- 0:00:01 --:--:--  0* 
Done waiting for 100-continue 
} [407 bytes data] 
100 750 0  0 100 750  0  46 0:00:16 0:00:16 --:--:--  0< 
HTTP/1.1 404 Not Found 
< Date: Tue, 18 Apr 2017 05:04:20 GMT 
< Set-Cookie: JSESSIONID=1nlr86kwwgbv612ia314pqj68w;Path=/ 
< Content-Type: text/html; charset=ISO-8859-1 
< Cache-Control: must-revalidate,no-cache,no-store 
< Content-Length: 321 
< Server: Jetty(9.2.2.v20140723) 
* HTTP error before end of send, stop sending 
< 
{ [321 bytes data] 
100 1071 100 321 100 750  19  45 0:00:16 0:00:16 --:--:--  0 
* Closing connection 0 
No JSON object could be decoded 

回答

0

似乎您正在使用不同的API。要上傳配置模式,您應該使用/kaaAdmin/rest/api/saveConfigurationSchema。請參閱API文檔here

+0

感謝您指出。之前的服務器REST API頁面爲空。所以,我必須使用[此鏈接](http://docs.kaaproject.org/display/KAA/Admin+REST+API)。現在我使用了新的API,它不會將配置模式.json文件作爲參數。相反,它看起來像我將不得不首先創建租戶CTL並使用配置架構的CTL架構標識。但是,現在我得到403「創建CTL架構」,雖然租戶ID和Authenticated用戶匹配。請幫忙。 – sr33kanth

+0

從文檔中,當_已驗證用戶不具有所需角色(TENANT_DEVELOPER或TENANT_USER)或應用程序的租戶ID與已驗證用戶的租戶ID不匹配時,將返回HTTP 403._我沒有嘗試過太多Kaa REST API。請問我爲什麼不嘗試在管理界面上做同樣的事情? –

+0

我試圖通過腳本配置我的應用程序。我已經使用UI在一臺服務器上完成它,並且它的所有工作都正常。現在我想編寫應用程序的配置腳本,並避免手動過程。我使用Python和請求模塊。 – sr33kanth