msgraph-sdk-python icon indicating copy to clipboard operation
msgraph-sdk-python copied to clipboard

OData system query options "format" not implemented

Open JoAllg opened this issue 1 year ago • 2 comments

Describe the bug

In the documentation there is the Query "format" introduced that is supposed specify the media format that the requests returns. Since the method is not implemented, the given example code for python throws an exception:

Traceback (most recent call last):
  File "/.../develop.py", line 37, in <module>
    query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: UsersRequestBuilder.UsersRequestBuilderGetQueryParameters.__init__() got an unexpected keyword argument 'format'

Expected behavior

I would to be able to format the responses as needed. As a suboptimal solution the docs should not refer to nonexisting methods.

How to reproduce

from msgraph import GraphServiceClient
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration

query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
    format = "json",
)

request_configuration = RequestConfiguration(
    query_parameters = query_params,
)
async def work():
    return await graph_client.users.get(request_configuration = request_configuration)

response = asyncio.run(work())

SDK Version

1.4.0

JoAllg avatar Jun 14 '24 15:06 JoAllg

Looks like there is an issue with the SDK, tried the http call and it worked with the format filter - GET https://graph.microsoft.com/v1.0/users?$format=json

shemogumbe avatar Jun 18 '24 14:06 shemogumbe

async def get_incident_by_id(client, incident_id): from pprint import pprint as pp

x =  client.security.incidents.by_incident_id(incident_id)
# print(dir(x))
result = await client.security.incidents.by_incident_id(incident_id).get(request_configuration = request_configuration)
print(result)

Traceback (most recent call last): File "/.../develop.py", line 37, in query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: UsersRequestBuilder.UsersRequestBuilderGetQueryParameters.init() got an unexpected keyword argument 'format'

I have the same question, is this repository still being updated? I don't seem to see that this issue will be resolved?

pangzi499 avatar Dec 04 '24 17:12 pangzi499