collingmedia/lasso-api

Lasso CRM API 的 PHP SDK。

v0.0.1 2019-07-11 22:37 UTC

This package is auto-updated.

Last update: 2024-09-12 09:52:12 UTC


README

Latest Version on Packagist Build Status StyleCI Total Downloads

管理 Lasso CRM 中的注册者和库存数据。所有请求都需要带有 Bearer JWT api 密钥令牌的授权头。API 密钥基于项目/位置,可从 Lasso 数据系统的业务联系人处获取。将来,项目管理员将能够从 Lasso CRM 网络应用程序中生成自己的 api 密钥。在 swagger 中试用:- 选择 授权 按钮,并将您的 api 密钥放入文本框中 - 确保api密钥以Bearer开头,包括一个空格将Bearer与 api 密钥分开 - 前往 swagger 定义中要尝试的路由 - 选择 试用 - 输入任何必需的字段、查询参数和请求数据 - 选择 执行 也可以使用 curl 在命令行中尝试,例如:curl -X GET \"https://api.lassocrm.com/v1/registrants/123456\" -H \"accept: application/json\" -H \"Authorization: Bearer ***apikey***\"

需求

PHP 7.0 及以上

安装 & 使用

Composer

然后运行 composer install

手动安装

下载文件并包含 autoload.php

    require_once('/lasso-api/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

请遵循 安装过程,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: JwtAuthorizer
$config = CollingMedia\Lasso\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = CollingMedia\Lasso\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new CollingMedia\Lasso\Api\InventoryApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->inventoryGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InventoryApi->inventoryGet: ', $e->getMessage(), PHP_EOL;
}

?>

API 端点文档

所有 URI 都是相对于 https://api.lassocrm.com/v1

模型文档

授权文档

JwtAuthorizer

  • 类型: API 密钥
  • API 密钥参数名: Authorization
  • 位置: HTTP 头部