Do you see something wrong in the command or the json?
Yes, youโre passing the name of the service, not the id of the service. The ziti CLI uses the API. You can see the requests when you use the ziti cli by passing โverbose and โoutput-request-json.
ziti edge create service-policy HttpDial Dial --semantic AnyOf --service-roles @http --verbose --output-request-json
RESTY 2025/09/01 17:08:22
---------------------- REQUEST LOG -----------------------
GET /edge/management/v1/services?filter=id%3D%22http%22 HTTP/1.1
HOST : ziti.controller
HEADERS:
Accept: application/json
Content-Type: application/json
User-Agent: go-resty/1.12.0 (https://github.com/go-resty/resty)
Zt-Session: xxxx
BODY :
***** NO CONTENT *****
----------------------------------------------------------
RESTY 2025/09/01 17:08:22
---------------------- RESPONSE LOG -----------------------
STATUS : 200 OK
RECEIVED AT : 2025-09-01T17:08:22.043475221Z
RESPONSE TIME : 25.722531ms
HEADERS:
Content-Type: application/json
Date: Mon, 01 Sep 2025 17:08:22 GMT
Expiration-Seconds: 1800
Expires-At: 2025-09-01 17:38:01.802945256 +0000 UTC
Server: ziti-controller/v0.0.0
Ziti-Instance-Id: cmelwayjw00001lqk1gbclrrc
BODY :
{
"data": [],
"meta": {
"filterableFields": [
"id",
"configs",
"createdAt",
"isSystem",
"terminatorStrategy",
"tags",
"roleAttributes",
"updatedAt",
"name"
],
"pagination": {
"limit": 10,
"offset": 0,
"totalCount": 0
}
}
}
----------------------------------------------------------
RESTY 2025/09/01 17:08:22
---------------------- REQUEST LOG -----------------------
GET /edge/management/v1/services?filter=name%3D%22http%22 HTTP/1.1
HOST : ziti.controller
HEADERS:
Accept: application/json
Content-Type: application/json
User-Agent: go-resty/1.12.0 (https://github.com/go-resty/resty)
Zt-Session: xxxx
BODY :
***** NO CONTENT *****
----------------------------------------------------------
RESTY 2025/09/01 17:08:22
---------------------- RESPONSE LOG -----------------------
STATUS : 200 OK
RECEIVED AT : 2025-09-01T17:08:22.068564177Z
RESPONSE TIME : 24.260135ms
HEADERS:
Content-Type: application/json
Date: Mon, 01 Sep 2025 17:08:22 GMT
Expiration-Seconds: 1800
Expires-At: 2025-09-01 17:38:01.802945256 +0000 UTC
Server: ziti-controller/v0.0.0
Ziti-Instance-Id: cmelwayjw00001lqk1gbclrrc
BODY :
{
"data": [
{
"_links": {
"configs": {
"href": "./services/68Piq9Q7n1yChH7naG1QtK/configs"
},
"self": {
"href": "./services/68Piq9Q7n1yChH7naG1QtK"
},
"service-edge-router-policies": {
"href": "./services/68Piq9Q7n1yChH7naG1QtK/service-edge-router-policies"
},
"service-policies": {
"href": "./services/68Piq9Q7n1yChH7naG1QtK/service-policies"
},
"terminators": {
"href": "./services/68Piq9Q7n1yChH7naG1QtK/terminators"
}
},
"createdAt": "2025-09-01T17:08:01.048Z",
"id": "68Piq9Q7n1yChH7naG1QtK",
"tags": {},
"updatedAt": "2025-09-01T17:08:01.048Z",
"config": {},
"configs": null,
"encryptionRequired": true,
"maxIdleTimeMillis": 0,
"name": "http",
"permissions": [
"Invalid"
],
"postureQueries": [
{
"isPassing": true,
"policyId": "dummy invalid policy: no posture checks defined",
"policyType": "Invalid",
"postureQueries": []
}
],
"roleAttributes": null,
"terminatorStrategy": "smartrouting"
}
],
"meta": {
"filterableFields": [
"createdAt",
"isSystem",
"terminatorStrategy",
"tags",
"roleAttributes",
"updatedAt",
"name",
"id",
"configs"
],
"pagination": {
"limit": 10,
"offset": 0,
"totalCount": 1
}
}
}
----------------------------------------------------------
POST to https://ziti.controller/edge/management/v1/service-policies
{
"identityRoles": [],
"name": "HttpDial",
"postureCheckRoles": [],
"semantic": "AnyOf",
"serviceRoles": [
"@68Piq9Q7n1yChH7naG1QtK"
],
"tags": {},
"type": "Dial"
}
RESTY 2025/09/01 17:08:22
---------------------- REQUEST LOG -----------------------
POST /edge/management/v1/service-policies HTTP/1.1
HOST : ziti.controller
HEADERS:
Accept: application/json
Content-Type: application/json
User-Agent: go-resty/1.12.0 (https://github.com/go-resty/resty)
Zt-Session: xxxx
BODY :
{
"identityRoles": [],
"name": "HttpDial",
"postureCheckRoles": [],
"semantic": "AnyOf",
"serviceRoles": [
"@68Piq9Q7n1yChH7naG1QtK"
],
"tags": {},
"type": "Dial"
}
----------------------------------------------------------
RESTY 2025/09/01 17:08:22
---------------------- RESPONSE LOG -----------------------
STATUS : 201 Created
RECEIVED AT : 2025-09-01T17:08:22.098120414Z
RESPONSE TIME : 28.430354ms
HEADERS:
Content-Type: application/json
Date: Mon, 01 Sep 2025 17:08:22 GMT
Expiration-Seconds: 1800
Expires-At: 2025-09-01 17:38:01.802945256 +0000 UTC
Server: ziti-controller/v0.0.0
Ziti-Instance-Id: cmelwayjw00001lqk1gbclrrc
BODY :
{
"data": {
"_links": {
"self": {
"href": "./service-policies/4dcT3y1ObxCRYYJBdz89bk"
}
},
"id": "4dcT3y1ObxCRYYJBdz89bk"
},
"meta": {}
}
----------------------------------------------------------
New service policy HttpDial created with id: 4dcT3y1ObxCRYYJBdz89bk
cdaws:ubuntu@ip-172-31-47-200:~$