dynamics-tools / dynamics-web-api-php-wrapper

该软件包最新版本(1.0.1.1)没有可用的许可信息。

Microsoft Dynamics Web API 的 PHP 8.1 包装器

1.0.1.1 2024-07-17 20:28 UTC

This package is auto-updated.

Last update: 2024-09-17 20:48:17 UTC


README

介绍

本软件包不是为了作为 Microsoft Dynamics 的深入 SDK。其主要目的是简化 Dynamics Web API 用户的身份验证和请求设置过程。

身份验证

我们使用应用程序用户通过服务器到服务器的 OAuth 身份验证。为了成功认证,您需要设置以下环境变量

APPLICATION_ID:应用程序(客户端)ID

APPLICATION_SECRET:应用程序(客户端)密钥

TENANT_ID:租户 ID

INSTANCE_URL:Dynamics(实例)URL

API 文档

此版本的 Dynamics Web API 的 API 文档可以在 此处 找到。

使用示例

在运行示例之前,请确保已设置环境变量。

使用客户端

use DynamicsWebApi\Client;
use DynamicsWebApi\ClientFactory;

require_once 'vendor/autoload.php';

$client = Client::createInstance();
$response = $client->request('/CloneAsSolution', 'POST', [
'ParentSolutionUniqueName' => 'MySolution',
'DisplayName' => 'MySolution',
'VersionNumber' => '1.12.0.0'
]);

$responseJson = json_decode($response->getBody()->getContents(), true);
echo $responseJson['SolutionId'];

使用助手

use DynamicsWebApi\Helper;

require_once 'vendor/autoload.php';

$helper = new Helper();
$helper->updateEntity('pluginassemblies', '38938383-383838-392912-192882', ['name' => 'MyPluginAssembly'], '9.2');
$helper->publishAllChanges();