Segments
A Segment identifies a group/set of Wallet passes that contains a tag or combination of tags, using boolean and, or, and not operators. Use segments to group and target passes for subsequent updates.
Create segment
Create a segment for a project.
POST /segments/{projectId}
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
Request body:
Contains and, or, or not operators for tags that identify your segment.
Content-Type:
OBJECT PROPERTIESapplication/json- criteria object<Segment selector>
Boolean tag selectors specifying a group of passes. You can nest
ANDandORselectors. - display_name string
The name of the segment.
Responses
200
A response returns a segment ID that you can use to reference the segment in future operations.
Response body:
- Content-Type:OBJECT PROPERTIES
application/json- ok boolean
If true, the operation completed successfully.
- operationId string
An identifier for the operation. Use this value to reference the operation for troubleshooting purposes.
- segmentId string
An identifier for the segment. Use this value to reference the segment in other operations.
Examples
Example request
POST /v1/segments/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2
{
"criteria": {
"and": [
{
"tag": "TZ_PST"
},
{
"not": {
"tag": "TZ_ET"
}
}
]
},
"display_name": "timezone"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"ok": true,
"segmentId": "b13666df-e5b3-4e42-8919-f8d63bd7ce2a",
"operationId": "dd2f1d32-aca9-4463-91c2-a3420bbcd489"
}
Delete segment
Delete a segment by ID. This operation just deletes the segment criteria. The passes previously selected by this criteria are unchanged.
DELETE /segments/{projectId}/{segmentId}
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
- segmentId stringREQUIREDThe ID of the segment.
Responses
204
A successful delete request returns no content.
Examples
Example request
DELETE /v1/segments/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2
Response
HTTP/1.1 204 No Content
List segments
List meta information for all segments for a project.
GET /segments/{projectId}
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
Responses
200
A response returns a list of segments for a project.
Response body:
- Content-Type:OBJECT PROPERTIES
application/json- segments array[object]
Examples
Example request
GET /v1/segments/12345 HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"segments": [
{
"creation_date": "2017-03-17T05:45:21Z",
"display_name": "timezone",
"id": "3b13666df-e5b3-4e42-8919-f8d63bd7ce2a",
"modification_date": "2017-03-17T05:45:21Z"
},
{
"creation_date": "2017-03-17T23:29:06Z",
"display_name": "my testing segment",
"id": "5eae7f52-3dc7-4a67-8a89-9b357815e7f7",
"modification_date": "2017-03-17T23:29:06Z"
}
]
}
Look up segment
Returns the selector criteria for a segment.
GET /segments/{projectId}/{segmentId}
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
- segmentId stringREQUIREDThe ID of the segment.
Responses
200
A successful request returns the selection criteria for the segment.
Response body:
- Content-Type:OBJECT PROPERTIES
application/json- criteria object<Segment selector>
Boolean tag selectors specifying a group of passes. You can nest
ANDandORselectors. - display_name string
The name of the segment.
Examples
Example request
GET /v1/segments/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a HTTP/1.1
Authorization: Basic <Base64 key>
Api-Revision: 1.2
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"criteria": {
"and": [
{
"tag": "TZ_PST"
},
{
"not": {
"tag": "TZ_ET"
}
}
]
},
"display_name": "timezone"
}
Update passes by segment
Update passes by segment ID and template ID.
PUT /segments/{projectId}/{segmentId}/passes
Query parameters:
- templateId string
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
- segmentId stringREQUIREDThe ID of the segment.
Request body:
Provide only the fields you want to update.
Content-Type:
OBJECT PROPERTIESapplication/json- fields object
Responses
200
A response returns one or more
ticketIdvalues, each referencing the pass update operation.Response body:
- Content-Type:OBJECT PROPERTIES
application/json- ticketId integer
A ticket you can use to reference this operation for status, troubleshooting, or logging purposes.
Examples
Example request
PUT /v1/segments/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a/passes?templateId=6789 HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2
{
"fields":{
"secondary1":{
"value":"Mega Offer"
},
"primary1":{
"value":"$20 Off"
}
}
}
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"ticketId": 123
}
Update segment
Update selection criteria or the display name for a segment.
PUT /segments/{projectId}/{segmentId}
Request headers:
- Api-Revision stringREQUIREDThe particular API revision you want to use. In general, this is
1.2.Possible values:
1.2
Path parameters:
- projectId stringREQUIREDThe ID of the project.
- segmentId stringREQUIREDThe ID of the segment.
Request body:
Content-Type:
OBJECT PROPERTIESapplication/json- criteria object<Segment selector>
Boolean tag selectors specifying a group of passes. You can nest
ANDandORselectors. - display_name string
The name of the segment.
Responses
200
A response returns a segment ID that you can use to reference the segment in future operations.
Response body:
- Content-Type:OBJECT PROPERTIES
application/json- ok boolean
If true, the operation completed successfully.
- operationId string
An identifier for the operation. Use this ID to reference the operation for troubleshooting purposes.
- segmentId string
An identifier for the segment that you can use to reference the segment in other operations.
Examples
Example request
PUT /v1/segments/12345/3b13666df-e5b3-4e42-8919-f8d63bd7ce2a HTTP/1.1
Authorization: Basic <Base64 key>
Content-Type: application/json
Api-Revision: 1.2
{
"criteria": {
"and": [
{
"tag": "TZ_PST"
},
{
"not": {
"tag": "TZ_ET"
}
}
]
},
"display_name": "timezone_info"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"ok": true,
"segmentId": "3b13666df-e5b3-4e42-8919-f8d63bd7ce2a",
"operationId": "f573b3c5-b0ee-4461-a179-2e78aab20400"
}