Segments
Create, update, delete, and query Segments in SendGrid.
テーブル固有の情報
Select
すべてのセグメントの取得、またはId でのフィルタが可能です。
SELECT * FROM Segments WHERE Id = '1'
Insert
特定の抽出条件によってセグメントは受信者を分割できます。抽出条件を指定するには、ConditionsField カラムと抽出条件を適用するリストのId を使います。
ConditionsAndOr カラムは与えられたフィールドと前のフィールドを接続します。
INSERT INTO Segments (Name, ListId, ConditionsField1, ConditionsValue1, ConditionsOperator1, ConditionsAndOr1, ConditionsField2, ConditionsValue2, ConditionsOperator2, ConditionsAndOr2) VALUES ("New Segment", 123, 'age', '20', '>', '', 'age', '30', '<', 'and')
上記のステートメントは20歳~30歳の受信者が含まれているセグメントを作成します。
Update
名前またはコンディションを更新することができます。すべてのセットが上書きされるので、フルセットを指定してください。
UPDATE Segments SET Name = 'Name Updated', ConditionsField1 = 'age', ConditionsOperator1 = '<=', ConditionsAndOr1 = '', ConditionsValue1 = '30' WHERE Id = '123'
Delete
Id を指定することでセグメントを削除できます。
DELETE FROM Segments WHERE Id = '123'
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Integer | True |
The Id of the segment. | |
Name | String | False |
The name of the segment. | |
ListId | Integer | False |
The Id of the list associated with the segment. | |
RecipientCount | Integer | True |
The recipient count of the segment. | |
ConditionsField1 | String | False |
Field name for the first condition. | |
ConditionsValue1 | String | False |
Field value for the first condition. | |
ConditionsOperator1 | String | False |
Condition operator for the first condition. | |
ConditionsAndOr1 | String | False |
How to connect to the previous condition. Allowed values are AND or OR. | |
ConditionsField2 | String | False |
Field name for the second condition. | |
ConditionsValue2 | String | False |
Field value for the second condition. | |
ConditionsOperator2 | String | False |
Condition operator for the second condition. | |
ConditionsAndOr2 | String | False |
How to connect to the previous condition. Allowed values are AND or OR. | |
ConditionsField3 | String | False |
Field name for the third condition. | |
ConditionsValue3 | String | False |
Field value for the third condition. | |
ConditionsOperator3 | String | False |
Condition operator for the third condition. | |
ConditionsAndOr3 | String | False |
How to connect to the previous condition. Allowed values are AND or OR. | |
ConditionsField4 | String | False |
Field name for the fourth condition. | |
ConditionsValue4 | String | False |
Field value for the fourth condition. | |
ConditionsOperator4 | String | False |
Condition operator for the fourth condition. | |
ConditionsAndOr4 | String | False |
How to connect to the previous condition. Allowed values are AND or OR. | |
ConditionsField5 | String | False |
Field name for the fifth condition. | |
ConditionsValue5 | String | False |
Field value for the fifth condition. | |
ConditionsOperator5 | String | False |
Condition operator for the fifth condition. | |
ConditionsAndOr5 | String | False |
How to connect to the previous condition. Allowed values are AND or OR. |