Hi, there is a bug preventing segment creation through graphql when the segment query has the keyword “MATCH” even though it is a perfectly valid segment query and it was able to be created successfully on shopify admin dashboard:
It fails with segmentCreate graphql:
mutation segmentCreate($name: String!, $query: String!) {
segmentCreate(name: $name, query: $query) {
segment {
id
}
userErrors {
field
message
}
}
}
variables:
{
"name":"Customers with store credit not tagged",
"query":"store_credit_accounts MATCHES (balance > 0) AND customer_tags NOT CONTAINS 'has_store_credit_balance'"
}
However, it gives this error:
{
"data": {
"segmentCreate": {
"segment": null,
"userErrors": [
{
"field": [
"query"
],
"message": "Query Line 1 Column 0: 'MATCHES' is unexpected."
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 20000,
"currentlyAvailable": 19990,
"restoreRate": 1000
}
}
}
}
However, when creating it through admin dashboard, it works: