Point Groups

Note

此页面的内容需要进行重大更新。旧页面包含过时且可能不准确的信息。您仍然可以访问它,具体请参见 Mautic Developer Documentation archived repository

如果您有兴趣帮助开发此页面和其他新内容的文档,请考虑加入我们的文档工作组。

请阅读 Contributing GuidelinesContributing to Mautic’s documentation 以开始您的贡献。

使用此端点来管理 Mautic 中的联系方式分组。

<?php
use Mautic\MauticApi;
use Mautic\Auth\ApiAuth;

// ...
$initAuth = new ApiAuth();
$auth     = $initAuth->newAuth($settings);
$apiUrl   = "https://your-mautic.com";
$api      = new MauticApi();
$pointGroupApi = $api->newApi("pointGroups", $auth, $apiUrl);

Get Point Group

<?php

//...
$pointGroup = $pointGroupApi->get($id);
"pointGroup": {
    "id": 47,
    "name": "Group A",
    "description": "This is my first Point Group created via API.",
    "isPublished": true,
    "dateAdded": "2024-02-29T12:17:52+00:00",
    "dateModified": null,
    "createdBy": 2,
    "createdByUser": "Admin User",
    "modifiedBy": null,
    "modifiedByUser": null,
}

获取单个 ID 的联系方式分组。

HTTP 请求

GET /points/groups/ID

响应

预期响应代码: 200

请参见 JSON 代码示例。

联系方式分组属性

名称

类型

描述

id

int

联系方式分组的 ID

name

string

联系方式分组名称

description

string

联系方式分组描述

isPublished

boolean

是否已发布联系方式分组

dateAdded

datetime

创建联系方式分组的日期/时间

createdBy

int

创建联系方式分组的用户 ID

createdByUser

string

创建联系方式分组用户的姓名

dateModified

datetime/null

最后修改联系方式分组的日期/时间

modifiedBy

int

最后修改联系方式分组的用户 ID

modifiedByUser

string

最后修改联系方式分组用户的姓名

列出联系方式分组

<?php

//...
$pointGroups = $pointGroupApi->getList($searchFilter, $start, $limit, $orderBy, $orderByDir, $publishedOnly, $minimal);

```json {

“total”: 4, “pointGroups”: [

{

“id”: 47, “name”: “Group A”, “description”: “This is my first Point Group created via API.”, “isPublished”: true, “dateAdded”: “2024-02-29T12:17:52+00:00”, “dateModified”: null, “createdBy”: 2, “createdByUser”: “Admin User”, “modifiedBy”: null, “modifiedByUser”: null

]

}

HTTP Request

GET /points/groups

Response

Expected Response Code: 200

See JSON code example.

Point Group Properties

Name

Type

Description

total

int

Count of all Point Groups

id

int

ID of the Point Group

name

string

Point Group name

description

string

Point Group description

isPublished

boolean

Whether the Point Group is published

dateAdded

datetime

Date/time Point Group was created

createdBy

int

ID of the User that created the Point Group

createdByUser

string

Name of the User that created the Point Group

dateModified

datetime/null

Date/time Point Group was last modified

modifiedBy

int

ID of the User that last modified the Point Group

modifiedByUser

string

Name of the User that last modified the Point Group

Create Point Group

<?php

$data = [
    'name'        => 'Group A',
    'description' => 'This is my first Point Group created via API.'
];

$pointGroup = $pointGroupApi->create($data);

HTTP Request

POST /points/groups/new

Post Parameters

Name

Description

name

Point Group name is the only required field

description

A description of the Point Group.

Response

Expected Response Code: 201

Properties

Same as Get Point Group.

Edit Point Group

<?php

$id   = 1;
$data = [
    'name'        => 'New Point Group name',
    'description' => 'Updated description of the Point Group.'
];

$pointGroup = $pointGroupApi->edit($id, $data);

HTTP Request

PATCH /points/groups/ID/edit

Post Parameters

Name

Description

name

Point Group name is the only required field

description

A description of the Point Group.

Response

Expected Response Code: 200

Properties

Same as Get Point Group. ```

删除点组

<?php

$pointGroup = $pointGroupApi->delete($id);

删除一个点组。

HTTP 请求

DELETE /points/groups/ID/delete

响应

预期的响应代码: 200

属性

获取点组 相同。