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

How to use the SDK to write Graph calls that aren't provided by the SDK API

Open srmo opened this issue 2 years ago • 4 comments

Ahoi,

first, thanks for the SDK. It makes life easier and helps me to stay in the python eco-system for such tasks. Now, I'm not really understanding Graph or the SDK well enough to see how I could write my own queries. For example, I'd like to call the reports/getTeamsTeamActivityDetail(period='D90')?$format=application/json endpoint. As I don't see it in SDK 1.0.0a12, I'd like to "manually" call it and process the results.

Is this even feasable? Please excuse me if this call actually is in the API and I just didn't see it - take it as an example.

Is calling arbitrary endpoints even supported? Did I miss this when reading in README / Samples?

srmo avatar Jun 21 '23 07:06 srmo

@srmo

Hi there, thanks for trying out our SDK

Our SDK covers the entire surface area of the Graph v1.0 api so yes, the call is actually available using the SDK. The resultant call would be client.reports.get_teams_team_activity_detail_with_period('D90').get()

However to answer your question, yes we do support passing a url and getting back a response that is deserialized into the respective Graph model. We also support getting the native response, if you prefer to work with raw json.

I'll add these scenarios to the samples.

samwelkanda avatar Jun 30 '23 12:06 samwelkanda

@samwelkanda : thanks for the hints! I'll try to get a better understanding of the API to be able to navigate it :)

srmo avatar Jul 17 '23 08:07 srmo

@samwelkanda has the custom URL scenario been added to the samples?

pl4nty avatar Jan 16 '24 03:01 pl4nty

Raw URL support is available in the SDK, we will look into updating the samples

shemogumbe avatar Apr 03 '24 13:04 shemogumbe