Segments
These endpoints allow you to retrieve, create, update, and delete Segment(s).
List all Segments
This query allows you to retrieve a paginated list of all your Segments. By default, a maximum of 25 Segments are shown per page.
Arguments
- Name
query
- Type
- String!
- Description
Supported filter parameters:
order_by
order_dir
- Name
after
- Type
- String
- Description
Returns the elements that come after the specified cursor.
- Name
first
- Type
- String
- Description
Returns up to the first
n
elements from the list.
Fields
- Label
Segment!
- Description
The Segment! query type.
Request
query SegmentsQuery($first: Int, $after: String, $query: String!){
segments(query: "order_by:id order_dir:desc", after: "WzVE4OTA5LDEe/4OTA5XQ==", first: 10){
edges{
node{
id
name
description
}
cursor
}
pageInfo{
endCursor
hasNextPage
}
}
}
Response
{
"data": {
"edges": [{
"node": {
"id": "U2VnbWVudDozMQ==",
"name": "Segment test",
"description": "description ...",
},
"cursor": "WzE5MTM1MCwxOTEzNTBd"
}],
"pageInfo": {
"endCursor": "WzE0Njk5MSwxNDY5OTFd",
"hasNextPage": true
}
}
}
Create a Segment
This query allows you to add a new Segment.
Arguments
- Label
SegmentInput!
- Description
The SegmentInput type.
Fields
- Label
Segment!
- Description
The Segment! query type.
Request
mutation mutationName($node: SegmentInput!) {
createSegment(node: $node){
# Segment type fields
}
}
Response
{
"data": {
"createSegment": {
"id": "U2VnbWVudDozMQ==",
"name": "Segment test",
"description": "description ..."
}
}
}
Retrieve a Segment
This query allows you to retrieve a Segment by providing its id.
Arguments
- Name
id
- Type
- ID!
- Description
The Segment id.
Fields
- Label
Segment!
- Description
The Segment! query type.
Request
query SegmentQuery($id: ID!){
node(id: $id){
... on Segment {
# Segment type fields
}
}
}
Response
{
"data": {
"node": {
"id": "U2VnbWVudDozMQ==",
"name": "Segment test",
"description": "description ..."
}
}
}
Update a Segment
This query allows you to perform an update on a Segment.
Arguments
- Name
id
- Type
- Int!
- Description
The Segment id.
- Name
node
- Label
SegmentInput!
- Description
The Segment node.
Fields
- Label
Segment!
- Description
The Segment! query type.
Request
mutation updateSegmentMutation($node: SegmentInput!, $id: ID!){
updateSegment(node: $node, id: $id){
# Segment type fields
}
}
Response
{
"data": {
"updateSegment": {
"id": "U2VnbWVudDozMQ==",
"name": "Segment test",
"description": "description ..."
}
}
}
Delete a Segment
This query allows you to delete Segments.
Arguments
- Name
items
- Type
- [ID!]!
- Description
The Segment ids.
Fields
- Name
[ID]
- Description
List of segment ids.
Request
mutation deleteSegmentsMutation($items: [ID!]!){
deleteSegments(items: $items){
# [ID] type fields
}
}
Response
{
"data": {
"deleteSegments": [
"UHJvZHVjdDoxNTUxMQ==",
"UHJvZHVjdFKWATUxMQ=="
]
}
}