How to introspect the GraphQL API

Hello guys,

I'm integrating Prismic with some projects using NextJS + TypeScript and I wish I could generate the typeset based in my graphql schema or based on the introspection.

I tried by many ways to do that using tools such as Apollo Codegen, Prisma generator and also using Insomnia. However, all of them, can't read o introspect the API.

It's possible to access the schema or introspect it some way?

Here's the full detailed request and response of an attempt to introspect the GraphQL endpoint.

 Preparing request to https://my-app-dev.prismic.io/graphql
Using libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0
Enable automatic URL encoding
Enable SSL validation
Enable cookie sending with jar of 0 cookies
Found bundle for host my-app-dev.prismic.io: 0x7f9327927f70 [can multiplex]
Re-using existing connection! (#2) with host my-app-dev.prismic.io
Connected to my-app-dev.prismic.io (18.233.105.33) port 443 (#2)
Using Stream ID: 7 (easy handle 0x7f9328981800)
GET /graphql HTTP/2
Host: my-app-dev.prismic.io
User-Agent: insomnia/6.0.2
Prismic-ref: xxxxxxxxxxxxxxx
Content-Type: application/json
authority: my-app-dev.prismic.io
Accept-Language: en-CA
Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Accept: */*
Content-Length: 1765
{"query":"\n    query IntrospectionQuery {\n      __schema {\n        queryType { name }\n        mutationType { name }\n        subscriptionType { name }\n        types {\n          ...FullType\n        }\n        directives {\n          name\n          description\n          locations\n          args {\n            ...InputValue\n          }\n        }\n      }\n    }\n\n    fragment FullType on __Type {\n      kind\n      name\n      description\n      fields(includeDeprecated: true) {\n        name\n        description\n        args {\n          ...InputValue\n        }\n        type {\n          ...TypeRef\n        }\n        isDeprecated\n        deprecationReason\n      }\n      inputFields {\n        ...InputValue\n      }\n      interfaces {\n        ...TypeRef\n      }\n      enumValues(includeDeprecated: true) {\n        name\n        description\n        isDeprecated\n        deprecationReason\n      }\n      possibleTypes {\n        ...TypeRef\n      }\n    }\n\n    fragment InputValue on __InputValue {\n      name\n      description\n      type { ...TypeRef }\n      defaultValue\n    }\n\n    fragment TypeRef on __Type {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n                ofType {\n                  kind\n                  name\n                  ofType {\n                    kind\n                    name\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  ","operationName":"IntrospectionQuery"}
We are completely uploaded and fine
HTTP/2 400 
date: Mon, 23 Nov 2020 23:31:04 GMT
content-type: text/plain; charset=utf-8
content-length: 23
server: nginx
x-ratelimit-limit: 200
x-ratelimit-remaining: 177
x-ratelimit-reset: 1606174264
Received 23 B chunk
Connection #2 to host my-app-dev.prismic.io left intact

Hey Jan, thanks for reaching out. We've talked about Introspection queries made in the graphiQL interface before, please refer to these thread:

And if you have any questions please let me know:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.