Add Graph API version to base URI

Open
#195 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
api, backend

Research direction

Start by reading GraphClientFactory and the existing base_uri configuration, using the request examples in this issue as the expected entry points. The work is done when the factory uses Graph API version v1.0 by default, allows selecting beta, and requests no longer need a version prefix in their paths.

Written by the indexing model from the issue text.

Description

type:feature
Is your feature request related to a problem? Please describe the problem.

Currently, the base URI only contains the national cloud host, meaning each request needs a Graph API version prefix:

$httpClient = GraphClientFactory::createWithConfig($config);
$response = $httpClient->get("/v1.0/me");

Current workaround is to override the base_uri via config:


$httpClient = GraphClientFactory::createWithConfig(['base_uri' => NationalCloud::Global + "/v1.0"]);
$response = $httpClient->get("/me");

This would be a breaking change.

Describe the solution you'd like.

Support setting the Graph API version via the factory & default to v1.0
(With default v1.0)


$httpClient = GraphClientFactory::create();
$response = $httpClient->get("/me");

Or to change to beta


$httpClient = GraphClientFactory::setApiVersion('beta')::create();
$response = $httpClient->get("/me");
Additional context?

No response

Dominant language
PHP
Stars
16
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoftgraph/msgraph-sdk-php-core

All issues in microsoftgraph/msgraph-sdk-php-core

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.