msgraph-sdk-go: Query Parameters are not working due to missing $ prefix in logic
As mentioned in #114, AddQueryParameters
which sets the $search, $expand, $top, $skip etc. in github.com/microsoft/kiota-abstractions-go@v0.3.0/request_information.go
is using reflection to name the parameters which you are adding to your URLs in all API calls (e.g. (m *UsersRequestBuilder) CreateGetRequestInformation(options *UsersRequestBuilderGetOptions)
).
Unfortunately you need to inject some additional logic as the MS Graph query parameters require the $
ODATA prefix.
This means no API calls work as soon as you supply query parameters (so no paging, no filtering, no field fetching) otherwise you get an error like:
Request_BadRequest: Unrecognized query argument specified: ‘top,skip’.: error status code received from the API
I believe you should be able to fix this inside this library - the logic in microsoft/kiota-abstractions-go
isn’t wrong, you just can’t use the final results in this library because of MS graph API / OData requirements for the $ prefix.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (14 by maintainers)
I’m not sure, at this point the best course of actions for you would be to post in the Microsoft Graph identity Q&A forum the service team will be able to assist you. When asking questions there, it’s better to simply ask about the URL/request, not to mention any language.
For the sample, do you have a link? We’ve recently updated those (see #135), see the updated version https://github.com/microsoftgraph/msgraph-sdk-go#41-get-all-the-users-in-an-environment
(it now uses interfaces to support upcast)
Thanks, I’ll update the public docs. As per the Messages vs Users. yes, this is expected, it’s an example for messages you can adapt. Also the header is provided as an example, you don’t need to provide it.