我尝试将我的Watson Knowledge Studio模型ID添加到我的Watson Discovery配置as described here。
使用此命令下载我的配置效果很好:
curl -u "{username}":"{password}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/{environment_id}/configurations/{configuration_id}?version=2016-12-01" > my_config.json
但是当我尝试上传此文件而没有使用此命令进行任何更改时:
curl -X PUT -u "{username}":"{password}" -H "Content-Type: application/json" -F configuration=@my_config.json "https://gateway.watsonplatform.net/discovery/api/v1/environments/{environment_id}/configurations/{configuration_id}?version=2016-12-01"
我将永远得到:
{
"code": 400,
"error": "Unexpected token -"
}
我错过了什么吗?
答案 0 :(得分:1)
在IBM的一些帮助下,似乎文档是错误的。 正确的命令是
public void makeScoreboard() {
if(this.getConfig().getBoolean("Scoreboard") == true) {
board = Bukkit.getScoreboardManager().getNewScoreboard();
Date now = new Date();
SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
Objective objective = board.registerNewObjective("Test", "Test2");
objective.setDisplayName(ChatColor.AQUA + "§aMazeRunner §8┃ §c" + StartCountdown.timeUntilStart);
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
team = board.registerNewTeam("Team");
team.setPrefix("");
Score score2 = objective.getScore(ChatColor.GOLD + "§6§l» Time");
score2.setScore(8);
Score score3 = objective.getScore(ChatColor.GOLD + "§f" + date.format(now));
score3.setScore(7);
Score score4 = objective.getScore(ChatColor.RED + " ");
score4.setScore(6);
Score score5 = objective.getScore(ChatColor.GOLD + "§6§l» Server");
score5.setScore(5);
Score score6 = objective.getScore(ChatColor.GOLD + "§3EU§8: §f2266");
score6.setScore(4);
Score score7 = objective.getScore(ChatColor.RED + " ");
score7.setScore(3);
Score score8 = objective.getScore(ChatColor.GOLD + "§6§l» Teams");
score8.setScore(2);
Score score9 = objective.getScore(ChatColor.GOLD + "§fHumans: 2");
score9.setScore(1);
Score score10 = objective.getScore(ChatColor.GOLD + "§fGrievers: 0");
score10.setScore(0);
}
else{
}
}
答案 1 :(得分:0)
我同意 - 文档here是错误的。 什么对我有用:
1)从已编辑的my_config.json配置文件中删除配置ID(因为这是默认配置)
2)插入新配置(并获取新生成的配置ID>注意请求中没有设置配置ID)
curl -X POST -u {username}":"{password}" -H "Content-Type: application/json" -d@my_config.json "https://gateway.watsonplatform.net/discovery/api/v1/environments/{environment_id}/configurations?version=2016-12-01"