-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to query product ingestion API since CustomRequestBuilder removed in V6 #2096
No way to query product ingestion API since CustomRequestBuilder removed in V6 #2096
Comments
@baywet @andrueastman what do you think about us adding a public T customRequest(RequestInformation requestInformation, Class<T extends Parsable> responseType) |
Is this something that can be resolved with the generated
I believe this is functionally equivalent to the send methods in the request adapter. |
This API is "special" and doesn't follow the typical Graph conventions/infrastructure. They just happen to be on the same host. The base URI is
Assuming this is clear, does one of you want to work on a design here? We'd then generalize to other languages. |
Sounds good @baywet. Was targeting re-using our (de)serialization but it would be added effort to make the customer's custom models into Parsable's yet v5 used GSON to deserialize to models. Using an OkHttpClient with Graph auth middleware works better. Could the Graph auth middleware still be present by default & be initialized with the same auth provider the RequestAdapter uses to retain allowed hosts & other config + check for an I can take this on probably next week/sprint worst case. |
We could explore that approach but we need to be careful not to:
This would have the benefit of not asking customers to juggle between multiple okhttp clients. |
Just to be clear here, do we need the auth middleware/custom client as the token needed is different than the one that would be used for normal graph calls? In my head, this should ideally work as the // Create a request info object
var requestInformation = new RequestInformation();
requestInformation.httpMethod = HttpMethod.GET;
requestInformation.urlTemplate = "https://graph.microsoft.com/rp/xxxxx";
// Setup an error mapping
HashMap<String, ParsableFactory<? extends Parsable>> errorMapping = new HashMap();
errorMapping.put("XXX", ODataError::createFromDiscriminatorValue);
// get the response as a stream
var responseStream = graphClient.getRequestAdapter().sendPrimitiveCollection(requestInformation, errorMapping, Stream.class);
// TODO deserialize the stream as desired.
// OR get the parsable using a factory as User object
var deserializedResponse = graphClient.getRequestAdapter().send(requestInformation, errorMapping, User::createFromDiscriminatorValue);
A small challenge we may find with this is that the authentication providers act on RequestInformation instance from kiota abstractions while the middleware is handling transport specific objects(Request from okhttp) objects. Unless you mean hooking up on the |
The authentication request is a standard Azure Identity request with the default Graph scopes. My concerns with using the With the okHttpClient the methods to call are more direct & (de)serialization in the control of the developer.
Yeah, good point. We may have to add a method that converts from the native okHttp Request to RequestInformation |
@andrueastman the request adapter interface (and the associated request information) was never designed to be used by humans, but rather to facilitate the work of the generated clients/reduce the amount of generated code that's required. (on top of providing a level of indirection to avoid tight coupling with any given http client). The reason why we used this interface to implement tasks (batching, etc...) is mostly because we didn't want to have customers juggle with multiple clients, auth setup etc... For arbitrary requests, customers will get a much better experience using the native client augmented with the middleware handlers. In fact we used to support that in the previous generation of SDKs. The reason why we didn't feel the need to port it to this newer generation was because the generated portion supports so much more of the API surface, so there was a much smaller need to implement it. That's until we ran in this "odd API". |
Thanks for the insight here. This is the bit I was missing.
Not necessarily as they could use the methods returning a stream/string and then deserialize the values as they wish. However this is now moot. Let's go ahead with the earlier suggestion here. |
related microsoft/kiota-dotnet#270 |
authored microsoftgraph/msgraph-sdk-design#111 to help move this along |
Thank you all for your help patching this! 🎉 |
Hi all, so how can the latest change fulfill the need from @Tomanow . I am a bit lost now but I have similar requirement. I have tried @andrueastman 's solution and works but looks like @baywet doesn't find this way "desired"
|
My requirement is to call the below Graph API to access Sharepoint (aka SITE) and retrieve site id, but it doesn't seems the existing fluent-style API has such method https://graph.microsoft.com/v1.0/sites/{domain}:/sites/{path} |
Hi @mattchannn, For a "traditional" Graph API endpoint whose models we generate etc, we provide the Site site = client.sites().bySiteId("{hostname}:/{server-relative-path}").get();
// OR
Site site = client.sites().bySiteId("").withUrl(
"https://graph.microsoft.com/v1.0/sites/{hostname}:/{server-relative-path}"
).get(); |
Thank you for your advice, both options work! SiteCollectionResponse site = graphServiceClient
.sites()
.withUrl("https://graph.microsoft.com/v1.0/sites/{hostname}:/{server-relative-path}")
.get(); |
Actually |
Is your feature request related to a problem? Please describe the problem.
We are unable to upgrade to v6 since we can no longer construct custom URLs for graph requests, and the SDK we use (the partner marketplace product ingestion API) is not supported by the client.
The
BaseClient#customRequest()
method andCustomRequestBuilder
support was removed in v6 with no alternative provided.Describe the solution you'd like.
Support for building custom graph request URIs and/or SDK support for the partner marketplace product ingestion APIs.
Additional context?
We (MongoDB) are a significant Microsoft Azure Partner with high profile integrations relying on the Java SDK.
The text was updated successfully, but these errors were encountered: