Build with the API

GraphQL

A read-only graph of files, reports and usage for dashboards, in one request.

GraphQL lets one request ask for exactly the files, reports, comments and usage numbers a screen needs, with nothing extra and no second trip. It is read-only: there is no way to change anything through it.

Send a query

POST/graphqlPeople signed in with a session. API keys cannot use it.
curl https://gridline-data-analysis-app.duckdns.org/graphql \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "query": "{ files(first: 5) { nodes { id originalName version report { status qualityScore } } pageInfo { hasMore nextCursor } } }" }'

What you can ask for

QueryReturns
files(first, after, sort, filter)The files you may see, with the same filters, cursor and visibility rules as GET /files. Up to 50 per page.
file(id)One file, or null if you may not see it.
usage(from, to)The same analytics as GET /analytics/usage. Admins only.

A File has its report (status, metrics, rule results, score, summary), its uploader, its versions (up to 50), a commentCount and a comments thread. grants (who a restricted file is shared with) is filled in only for an admin or the uploader.

A dashboard in one request
{
  files(first: 20, filter: { visibility: restricted }, sort: NEWEST) {
    nodes {
      id
      originalName
      uploader { fullName }
      report { status qualityScore ruleResults { name status severity } }
      versions { version createdAt }
    }
    pageInfo { hasMore nextCursor }
  }
}

The same rules as REST

  • A restricted file you may not see is null, exactly as REST answers 404.
  • Numbers are computed by the same code as the REST endpoints, so the two always agree.
  • Related data (uploaders, reports, versions) is fetched once per request, in batches, and always limited to your company.

Limits

LimitValue
Query depth6 levels
Query cost1,000 (lists cost more, and nested lists multiply)
files(first: …)At most 50

Limits are checked before anything runs, and the error says which was exceeded and by how much. Asking for the same expensive field six times under different names does not get around them: it is priced as six.