Closed Md-husain0522 closed 1 week ago
Thanks for raising this @Md-husain0522
Just to confirm here, are you parsing the response using the SDK? Do you get an error or incorrect mapping on the reading the response using the SDK?
I'm using these SDKs, and not parsing the result from the API, as it is traversable : using Microsoft.Graph; using Microsoft.Graph.Models; using Microsoft.Graph.Users.Item.Calendar.GetSchedule;
And the below API call:
This gives me a response of value array with scheduleditem collection. There is no error in the API response, but according to the documentation, the "status" for every item should be a text field, but the API response has it as an integer, hard to map which integer represents what status {free, tentative, busy, oof, workingElsewhere, unknown}.
How are you serializing the result
object to get the json string? Are you using the serialization helpers?
https://learn.microsoft.com/en-us/openapi/kiota/serialization?tabs=csharp#serialization-helpers
This should look something like
var jsonString = await KiotaSerializer.SerializeAsStringAsync("application/json", result, false);
Hi. I am not serializing the result. The properties in the result from the API are accessible without serialization. When you access through "result.Value", all other properties are accessible in the IDE , without knowing the format of the response.
There is no serialization in the code. I am using the exact response that I get from the GetSchedule API. No parser, or format in between.
Out of curiosity, how do you get this?
This is the exact result from the GetSchedule API, and also my question, that why "status" is an integer value, when the documentation says, it's a text field. Instead of 2, The API should be returning the mapped text value for this "2".
I don't think the API returns properties like odataType
and backingStore
. These will typically show up if you use an incompatible serializer to serialize the returned object to a string. The serializer may also serialize enums incorrecty to numbers rather than strings if not configured correctly.
Do you get a different result if you follow the guidance to use the helpers?
I have not used the serializer for the API response yet. But let me try, If this makes a change. Can you please suggest some serializers compatible for GetSchedule API response.
Let us know how this works out. This is the recommended approach as the Graph SDK is generated by Kiota.
var jsonString = await KiotaSerializer.SerializeAsStringAsync("application/json", result, false);
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
In Graph API, getSchedule action - According to documentation, the "Status" should be as string with possible values {free, tentative, busy, oof, workingElsewhere, unknown}, whereas our response contains an integer with values 1-5.
https://learn.microsoft.com/en-us/graph/outlook-get-free-busy-schedule , https://learn.microsoft.com/en-us/graph/api/calendar-getschedule?view=graph-rest-1.0&tabs=http and https://learn.microsoft.com/en-us/graph/api/resources/scheduleitem?view=graph-rest-1.0
Please assist and point us to the correct documention.
Request:
Response: