Saving JSON response

This is tagged GraphQL, so using only the GraphQL API, the answer is no.

GraphQL is a strictly typed API. It only allows in exactly what is predefined in the schema. It can accept less (unless required inputs) but it cannot accept more.

This however is possible with DQL, but if not correctly typed it will not be accessible by the GraphQL API endpoint generated from your pre-defined GraphQL schema.

Behind the GraphQL API endpoint is the Dgraph database. Dgraph is a loosely typed database and you can add data in through the bulk loader, live loader, or mutate endpoint that does not match any predefined schema exactly. JSON data can be added through the mutate endpoint, bulk loader and live loader (thanks for the correction @MichelDiz)

In answering your question, it is possible to “save” JSON responses directly to Dgraph, but not with the GraphQL API, and these saved JSON responses will not be exposed to your GraphQL API to later query, and mutate unless they are first typed correctly.

2 Likes