问题描述
我有一个管理脚本,该脚本通过对REST API的调用来创建Azure DevOps项目。只要name或description参数不包含特殊字符,此方法就可以正常工作。例如,如果描述中包含德国变音符号,则通话会失败。
这有效:
curl -k -D- -X POST -d '{"name":"Phantom","capabilities":{"processtemplate":{"templateTypeId":"6b724908-ef14-45cf-84f8-768b5384da45"},"versioncontrol":{"sourceControlType":"Git"}},"visibility":"private","description":"Innocent description without umlauts"}' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Basic secretauthorizationtoken=' https://dev.azure.com/AdminPlayground/_apis/projects?api-version=6.0-preview.4
这引发一个异常:
curl -k -D- -X POST -d '{"name":"Phantom","description":"Funny description with strange äöüß chars"}' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Basic secretauthorizationtoken=' https://dev.azure.com/AdminPlayground/_apis/projects?api-version=6.0-preview.4
例外是:
{"$id":"1","innerException":null,"message":"Value cannot be null.\r\nParameter name: projectToCreate","typeName":"System.ArgumentNullException,mscorlib","typeKey":"ArgumentNullException","errorCode":0,"eventId":0}
是否有人经历过类似的行为,也许可以提出解决方案? 谢谢!