updateDeviceProfileAssignment returning 200 OK and not 204 No Content

Timothy Dowling 0 Reputation points
2024-06-28T14:11:09.5+00:00

The following issue I am having is that when trying to change the enrollment profile of an iOS device using .net and httpclient, I am getting back a 200 response with an empty object. I have tried both in my code and with in Graph Explorer. Just last week I was getting a response 204

https://graph.microsoft.com/beta/deviceManagement/depOnboardingSettings/{####}/enrollmentProfiles/{####}/updateDeviceProfileAssignment

{
    "deviceIds": [
        "serialNumber"
    ]
}

Headers:
Authorization: Bearer {token}
Accept: application/json

Permissions Granted:
DeviceManagementServiceConfig.ReadWrite.All, 
DeviceManagementConfiguration.ReadWrite.All

Here is the response:

200 OK

Preview:
{}

Headers:
{
    "client-request-id": "38ed1c72-7704-77f2-a979-cba9cc8a30ce",
    "content-length": "0",
    "request-id": "889d6054-4721-43ed-94e6-de8b636bb524"
}

The response should be a 204 and the profile should be changed. What am I missing? Getting the response of 200 at least means the call is working, but it's not adding the profile to the device. I assume that if that if the profile is added, then I would get the 204 response.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,562 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,194 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,550 questions
Microsoft Intune Enrollment
Microsoft Intune Enrollment
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Enrollment: The process of requesting, receiving, and installing a certificate.
1,299 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,644 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 50,506 Reputation points
    2024-06-28T14:54:56.25+00:00

    There is no difference in HTTP responses between a 200 with a body and a 204 without one. They are the same thing. Every HTTP client I'm aware of will behave the same way.

    APIs can return either a 200 success with or without a body or they can provide a little extra context to the client and return a 204 which simply means there is no body. The client handles it the same either way. 2xx codes mean success, if there is a content body then additional information is available otherwise it isn't. It is up to the API to decide which it returns as there is no standard.

    Bear in mind you're using the beta endpoint which can and will change while you're using it. Until it is stabilized you should be prepared for changes. Irrelevant 200 and 204 are interchangeable and your code should behave the same either way.