Entitlement Service GraphQL 接口
Entitlement Service 的 GraphQL 接口用于产品目录、权益汇总、已分配用户、可分配用户和权益活动日志的读取。写入操作(分配更新、批量导入)请使用 REST 接口。
端点
| 功能 | 地址 |
|---|---|
| GraphQL 请求地址 | POST http://127.0.0.1:4317/graphql |
本地启动服务后,可在浏览器中访问 http://127.0.0.1:4317/graphiql 使用 GraphiQL 交互式调试。
查询示例
产品列表
graphql
query EntitlementProducts($organizationId: ID!) {
products(organizationId: $organizationId) {
id
icon
name
provider
description
status
supportedPlatforms
usageDimensions {
code
name
description
unit
}
entitlementInfo {
entitlementCode
grantType
allocationModel
subscriberId
subscriberAccountId
renewalDate
}
}
}变量:
json
{
"organizationId": "org-demo-001"
}产品详情
一次查询返回产品信息、权益条目、配额汇总、已分配用户和可分配用户。
graphql
query EntitlementProductDetail($productId: ID!, $organizationId: ID!) {
product(id: $productId, organizationId: $organizationId) {
id
icon
name
provider
description
status
supportedPlatforms
usageDimensions {
code
name
description
unit
}
entitlementInfo {
entitlementCode
grantType
allocationModel
subscriberId
subscriberAccountId
renewalDate
}
}
entitlements(productId: $productId, organizationId: $organizationId) {
id
productId
entitlementCode
usageDimensionCode
purchasedQuantity
allocatedQuantity
status
startDate
endDate
source
}
productEntitlementSummary(productId: $productId, organizationId: $organizationId) {
productId
purchasedQuantity
allocatedQuantity
availableQuantity
}
allocatedUsers(productId: $productId, organizationId: $organizationId) {
id
productId
entitlementId
seatQuantity
name
email
department
status
allocatedAt
sourceJobId
}
productUserAccess(productId: $productId, organizationId: $organizationId) {
id
productId
entitlementId
entitlementCode
seatQuantity
name
email
department
status
isAllocated
allocatedAt
}
}变量:
json
{
"organizationId": "org-demo-001",
"productId": "prod-insight-studio"
}活动日志
graphql
query EntitlementActivityLogs($input: ActivityLogListInput!) {
activityLogs(input: $input) {
totalElements
items {
id
productId
productName
entitlementId
actor {
type
displayName
email
}
target {
type
id
name
}
action
actionLabel {
id
defaultMessage
values {
key
value
}
}
summary
summaryMessage {
id
defaultMessage
values {
key
value
}
}
quantityDelta
result
eventTime
}
}
}变量:
json
{
"input": {
"organizationId": "org-demo-001",
"productId": "prod-insight-studio",
"sortField": "eventTime",
"sortDirection": "desc",
"pageNumber": 0,
"pageSize": 50
}
}pageNumber 从 0 开始,pageSize 默认 50,最大 500。支持的排序字段:actor、summary、product、result、eventTime。