microsoftgraph / msgraph-sdk-python

MIT License
382 stars 56 forks source link

OData system query options "format" not implemented #758

Open JoAllg opened 4 months ago

JoAllg commented 4 months ago

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

shemogumbe commented 4 months ago

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