我想添加新的targetserver,但我收到了以下错误。
curl: (6) Could not resolve host: <TargetServer name=TS1><Host>test.jokeindex.co
m<
curl: (6) Could not resolve host: \
{
"fault": {
"faultstring": "XMLThreatProtection stepDefinition XMLThreat: Execution
failed. reason: Unexpected char while looking for open tag ('<') character",
"detail": {
"errorcode": "steps.xmlthreatprotection.ExecutionFailed"
}
}
}
curl命令:
curl -H "Content-Type:text/xml" -X POST -d \ "<TargetServer name="TS1"><Host>test.jokeindex.com</Host><Port>80</Port><IsEnabled>true</IsEnabled></TargetServer>" \ -u nisarg:mypwd https://api.enterprise.apigee.com/v1/o/nisarg/environments/test/targetservers
答案 0 :(得分:0)
您需要在数据周围使用单引号,因为您在。中使用双引号。
所以试试这个:
curl -H "Content-Type:text/xml" -X POST -d '<TargetServer name="TS1"><Host>test.jokeindex.com</Host><Port>80</Port><IsEnabled>true</IsEnabled></TargetServer>' -u nisarg:mypwd https://api.enterprise.apigee.com/v1/o/nisarg/environments/test/targetservers