我们正在尝试创建如下所述的application resource type
:https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/application.md
请求:
POST https://graph.microsoft.com/beta/applications
{
"displayName": "MyCoolApp",
"passwordCredentials": [{
"customKeyIdentifier":"ObJix/HDVU+3+hH5RmA+dw==",
"endDateTime":"2018-10-19T17:59:59.6521653Z",
"keyId":"ed087fba-0068-431f-98d7-e6b74dedd931",
"startDateTime":"2016-10-19T17:59:59.6521653Z",
"value":"somepass"
}]
}
结果是:
{
"error": {
"code": "Request_BadRequest",
"message": "The property 'value' does not exist on type 'Microsoft.DirectoryServices.PasswordCredential'. Make sure to only use property names that are defined by the type.",
"innerError": {
"request-id": "038aa3bd-2b99-4329-a2ae-bc11d2f64609",
"date": "2018-02-04T14:23:57"
}
}
}
为什么value
不存在?下面是passwordCredentials
资源的 JSON 表示形式
{
"customKeyIdentifier": "binary",
"endDate": "String (timestamp)",
"keyId": "guid",
"startDate": "String (timestamp)",
"value": "string"
}
那就是:https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/passwordcredential.md
但是,我们能够创建一个指定了空 PasswordCredential 的应用程序 - 是的,应用程序已创建,我们在应用程序列表 (https://apps.dev.microsoft.com/#/appList( 上看到它,但无论如何我们都需要知道它的凭据。
有没有办法使用提供的凭据以编程方式创建应用程序?
好的,伙计们,我已经想通了。该文档显然已过时,因此目前passwordCredentials
正确的架构:
[{
"customKeyIdentifier": "binary",
"endDateTime": "String (timestamp)",
"keyId": "guid",
"startDateTime": "String (timestamp)",
"secretText": "string"
}...]
secretText
是应用程序密码的新属性名称,请勿再使用"value"
。
我最终只使用了 2 个道具:
{
"endDateTime": "2020-10-19T17:59:59.53Z",
"secretText": "should be 16-64 characters long"
}
我现在要做一个拉取请求来更改他们的文档
顺便说一句,这是一个资源的完整架构,它帮助我找到了答案:https://graph.microsoft.com/beta/$metadata#applications/$entity