Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

[Feature] Adds support for specifying API version - #20

Merged
Caitlin Russell (caitlinrussell) merged 1 commit into
microsoftgraph:masterfrom
martinjlowm:feature/api-version
Dec 4, 2017
Merged

[Feature] Adds support for specifying API version#20
Caitlin Russell (caitlinrussell) merged 1 commit into
microsoftgraph:masterfrom
martinjlowm:feature/api-version

Conversation

@martinjlowm

Copy link
Copy Markdown
Contributor

Tenants at https://graph.windows.net/ require the api-version query parameter to be present for any API calls. The use of api-version is described in [1]

This pull request adds a new (optional) API version option to tag all requests invoked from the Microsoft Graph instance.

[1] https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-graph-api-quickstart#graph-api-versions

@caitlinrussell

Copy link
Copy Markdown

Thanks for the PR, I will review shortly.
Are there any Graph API endpoints that require this version? The documentation you linked to is referring to Azure AD Graph and not Microsoft Graph.

@martinjlowm

Copy link
Copy Markdown
Contributor Author

That is true. Is supporting Azure AD Graph within the desired scope of this project? I have a couple of other changes to support it, which complement this pull request. I might just merge all my commits into a thorough pull request instead.

@caitlinrussell

Copy link
Copy Markdown

It is not in scope to support Azure AD Graph; however, if there are abstractions we can introduce in the SDK to allow developers to use both, I think that would be appropriate. If you'd like to make two separate PRs, make sure you sign the CLA so that I can merge this PR.

@caitlinrussell
Caitlin Russell (caitlinrussell) merged commit 4ee17fd into microsoftgraph:master Dec 4, 2017
@nunosilva800

Copy link
Copy Markdown

After this merge, using the Graph API with the api_version param set, results in an error:

graph = MicrosoftGraph.new(
  api_version: '1.0',
  cached_metadata_file: File.join(MicrosoftGraph::CACHED_METADATA_DIRECTORY, 'metadata_v1.0.xml'),
  &auth_callback
)

graph.me

Traceback (most recent call last):
        1: from (irb):22
OData::ClientError (400 BadRequest: "Query parameter api-version not allowed" from "https://graph.microsoft.com/v1.0/me?api-version=1.0")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants