ServiceNow: Custom GraphQL APIs Part 1

  • Parts of a GraphQL API
  • A basic example of returning data from a single record
  • how to connect schemas together to return even more data
  • how to return a list of related records


  • ServiceNow Instance on at least Paris
  • Postman application for testing

First step: creating the API

GraphQL Schema form for a new schema
  1. It decides the available data & “structure” for return results
  2. It determines the available inputs & maps them to the schema

ATF Test Query

Mapping values to the Schema

GraphQL Schema for atf API
GraphQL Resolver Mapping with Path=Query:atfTest and Resolver=getTestInformation

First Functional API

Adding Test Results

GraphQL Resolver Mapping with Path=atfTest:testHistory and Resolver=getTestHistory

Adding a Test Suite Query

Scripted Resolver for Getting Suite Information
Script for getting this an array of Tests related to a Test Suite
Resolver Mapping with Path=Query:atfTestSuite and Resolver=GetSuiteInformation
Resolver Mapping with Path=atfTestSuite:tests and Resolver=getTests

Opinion on Two ATF Features

Testing our Suite API

200 result from ATFTestSuite query

In Summary

Next Steps



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store