Pulsar GraphQL API

使用您的API密钥向/pulsar/graphql发送查询。一个请求遍历网站→验证→监视器,因此您可以在一次调用中精确获取所需的字段。

01模式

GraphQL SDL
type Query {
  me: Member
  network: NetworkStats
  sites: [Site!]!
  site(domain: String!): Site
  shopfront(hash: String!): Shopfront   # verify a hash embedded in an honest-shopfront SVG
}
type Member { id: Int!  email: String!  plan: String }
type NetworkStats {
  devicesLive: Int!   devicesEnrolled: Int!   countries: Int!
  verdicts24h: Int!   ok24h: Int!   okPct: Float   snapshots: Int!
}
type Site {
  id: Int!   domain: String!   title: String   seoScore: Int
  verified: PulsarVerification         # null until the network has checked it
  monitors: [Monitor!]!
  traffic(days: Int = 30): Traffic     # same aggregates the dashboard shows
  leads(days: Int = 30): Leads
  topPages(days: Int = 7, limit: Int = 10): [PageStat!]!
}
type PulsarVerification { verified: Boolean!  checks: Int!  uptimePct: Int  latencyMs: Int  lastCheckedAt: String }
type Monitor {
  id: Int!  name: String!  kind: String!
  up: Boolean   ttfbMs: Int   loadMs: Int   tlsDaysLeft: Int   vantagePoints: Int
  tlsVersion: String   tlsCipher: String   tlsFailure: String   tlsChainIncomplete: Boolean
}
type Traffic {
  days: Int!   visitors: Int!   pageviews: Int!
  avgVisitorsPerDay: Float      # null when there are no days with data
  series: [TrafficDay!]!
}
type TrafficDay { day: String!  visitors: Int!  visits: Int!  pageviews: Int! }
type Leads { total: Int!  unhandled: Int! }
type PageStat { url: String!  views: Int! }
type Shopfront {                      # idea 24: the statement behind a plaque, checked against our ledger
  hash: String!   status: String!     # active | superseded | broken | unknown
  site: String    builtAt: String     currentAt: String   shown: Boolean   # shown = the plaque is served right now
  sigValid: Boolean   digestValid: Boolean   pubkey: String   statement: String   sig: String   verdictRoot: String
  facts: String                       # canonical JSON of the signed figures
}

02示例查询

query
{
  network { devicesLive countries verdicts24h okPct }
  sites {
    domain
    traffic(days: 30) { visitors pageviews avgVisitorsPerDay }
    leads(days: 30) { total unhandled }
    topPages(days: 7, limit: 5) { url views }
    verified { uptimePct latencyMs checks }
    monitors { name kind up loadMs tlsDaysLeft }
  }
}

03调用它

curl
curl -s https://astrina.io/pulsar/graphql \
  -H 'X-Api-Key: YOUR_KEY' -H 'Content-Type: application/json' \
  -d '{"query":"{ network { devicesLive } sites { domain verified { uptimePct } } }"}'

只读:不支持变更、订阅和片段。每个数字都是一个真实的设备共识裁决——当网络尚未决定时,字段为null。调用会计入您的每日API配额。

此页面回答的问题

  • 一个针对网站的GraphQL查询
  • 监控法定人数裁决
  • 一个查询所有网站数据
  • 什么是 Pulsar GraphQL API
  • Pulsar GraphQL API 如何运作
  • Pulsar GraphQL API 解释
  • Pulsar GraphQL API 指南
  • 如何开始使用 Pulsar GraphQL API
  • Pulsar GraphQL API 评论
  • Pulsar GraphQL API 值得吗
  • Pulsar GraphQL API 定价
  • Pulsar GraphQL API 替代品
  • Pulsar GraphQL API 适合初学者
  • 为什么选择 Pulsar GraphQL API
  • Pulsar GraphQL API — 你得到的