API GraphQL di Pulsar

POST una query a /pulsar/graphql con la tua chiave API. Una richiesta attraversa siti → verifica → monitor, quindi recuperi esattamente i campi di cui hai bisogno in una singola chiamata.

01Schema

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
}

02Esempio di query

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 }
  }
}

03Chiamalo

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 } } }"}'

Solo lettura: le mutazioni, le sottoscrizioni e i frammenti non sono supportati. Ogni numero è un verdetto reale di consenso dei dispositivi — un campo è nullo quando la rete non ha ancora deciso. Le chiamate conteggiano contro il tuo limite API giornaliero.

Cosa risponde questa pagina

  • una query GraphQL per i siti
  • monitorare i verdetti del quorum
  • una query per tutti i dati del sito
  • che cos'è l'API GraphQL Pulsar
  • come l'API GraphQL Pulsar funziona
  • l'API GraphQL Pulsar spiegato
  • guida a l'API GraphQL Pulsar
  • come iniziare con l'API GraphQL Pulsar
  • recensioni di l'API GraphQL Pulsar
  • vale la pena l'API GraphQL Pulsar
  • prezzi di l'API GraphQL Pulsar
  • l'API GraphQL Pulsar alternative
  • l'API GraphQL Pulsar per principianti
  • perché l'API GraphQL Pulsar
  • l'API GraphQL Pulsar — cosa ottieni