Intune azure graph api创建deviceCompliancePolicyState返回400 Bad Request

时间:2017-05-24 15:45:40

标签: api azure microsoft-graph intune

致电

GET https://graph.microsoft.com/beta/managedDevices/dd9615c4-9d3b-4ece-9272-34a10e8fe908/

RESPONSE

 {
      "@odata.context": "https://graph.microsoft.com/beta/$metadata#managedDevices/$entity",
      "id": "dd9615c4-9d3b-4ece-9272-34a10e8fe908",
      "userId": null,
      "deviceName": "iPad Feb23",
      "hardwareInformation": {
        "serialNumber": null,
        "totalStorageSpace": 0,
        "freeStorageSpace": 0,
        "imei": "",
        "meid": null,
        "manufacturer": null,
        "model": null,
        "phoneNumber": null,
        "subscriberCarrier": null,
        "cellularTechnology": null,
        "wifiMac": null,
        "operatingSystemLanguage": null,
        "isSupervised": false,
        "isEncrypted": false,
        "isSharedDevice": false,
        "sharedDeviceCachedUsers": []
      },
      "ownerType": "personal",
      "deviceActionResults": [],
      "managementState": "managed",
      "enrolledDateTime": "2017-05-24T13:10:20.8964572Z",
      "lastSyncDateTime": "2017-05-24T15:16:02.6465376Z",
      "chassisType": "tablet",
      "operatingSystem": "iOS",
      "deviceType": "iPad",

  "complianceState": "compliant",
  "jailBroken": "False",
  "managementAgents": 2,
  "managementAgent": "mdm",
  "osVersion": "9.3.5",
  "easActivated": false,
  "easDeviceId": null,
  "easActivationDateTime": "0001-01-01T00:00:00Z",
  "aadRegistered": null,
  "enrollmentType": "userEnrollmentWithServiceAccount",
  "lostModeState": "disabled",
  "activationLockBypassCode": null,
  "emailAddress": null,
  "azureActiveDirectoryDeviceId": "00000000-0000-0000-0000-000000000000",
  "deviceRegistrationState": "registered",
  "deviceCategoryDisplayName": null,
  "isSupervised": false,
  "exchangeLastSuccessfulSyncDateTime": "0001-01-01T00:00:00Z",
  "exchangeAccessState": "none",
  "exchangeAccessStateReason": "none",
  "remoteAssistanceSessionUrl": "",
  "isEncrypted": false,
  "model": null,
  "manufacturer": null
}

但是,当我尝试发布任何内容似乎没有任何效果......根据此处的文档https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/intune_mam_mobileappidentifierdeployment_create

它应该可以正常工作这次调用的问题是什么......?

呼叫

POST https://graph.microsoft.com/beta/managedDevices/dd9615c4-9d3b-4ece-9272-34a10e8fe908/deviceCompliancePolicyStates/

{
  "@odata.type": "#microsoft.graph.deviceCompliancePolicyState",
  "settingStates": [
    {
      "@odata.type": "microsoft.graph.deviceCompliancePolicySettingState",
      "setting": "Setting value",
      "instanceDisplayName": "Instance Display Name value",
      "state": "notApplicable",
      "errorCode": 9,
      "errorDescription": "Error Description value",
      "userPrincipalName": "User Principal Name value",
      "sources": [
        {
          "@odata.type": "microsoft.graph.settingSource",
          "id": "Id value",
          "displayName": "Display Name value"
        }
      ]
    }
  ],
  "displayName": "Display Name value",
  "version": 7,
  "platformType": "androidForWork",
  "state": "notApplicable",
  "settingCount": 12
}

RESPONSE

    {
  "error": {
    "code": "No method match route template",
    "message": "No OData route exists that match template ~/entityset/key/navigation with http verb POST for request /StatelessDeviceConfigurationFEService/managedDevices('dd9615c4-9d3b-4ece-9272-34a10e8fe908')/deviceCompliancePolicyStates.",
    "innerError": {
      "request-id": "544c4ee2-a6de-4203-9c30-c3e589b77713",
      "date": "2017-05-24T15:48:30"
    }
  }
}

1 个答案:

答案 0 :(得分:0)

我是Microsoft Intune团队的工程师,专门从事Microsoft Graph和Microsoft Intune之间的集成。

在这种情况下,由于无法创建deviceCompliancePolicyState实体,因此文档存在问题,它是显示设备合规性策略状态的只读实体。我将努力纠正文档。如果您可以通过创建deviceCompliancePolicyState实体让我知道您尝试完成的场景,我可能会指出您正确的方向。

希望有所帮助

彼得