You will create your own source plugin for gatsby to get external data avaialable through a REST API into gatsby. The plugin will retrieve the data and create the gatsby nodes to make the data available through the gatsby graphql queries so you can use the data into your site.
To create this source plugin you will use some of the methods provided by the gatsby API like sourceNodes
, createNode
, createNodeId
and createContentDigest