Back

GraphQL: Which headers?

  • 0
  • Databases
  • Auth
  • Web
  • Cloud
Anil Karaniya
14 Apr, 2024, 13:43

from the overview section at the bottom

TL;DR
Developers having issues setting the correct endpoint and headers for GraphQL in Appwrite. Make sure to set the proper permissions and headers, including the API key. Double-check the endpoint format (https://cloud.appwrite.io/v1/graphql) and create the API key in the project settings. Lower the package version if on the cloud. Make sure to follow the documentation for the correct header API properties.
Anil Karaniya
14 Apr, 2024, 13:43

If you are using cloud ur endpoint will be https://cloud.appwrite.io/v1

flupsiupsi
14 Apr, 2024, 13:44

ah, without the trailing /graphql?

Anil Karaniya
14 Apr, 2024, 13:44

Yes

flupsiupsi
14 Apr, 2024, 13:44

Yes, I created one on the project overview page on the bottom.

Anil Karaniya
14 Apr, 2024, 13:44

okh

Anil Karaniya
14 Apr, 2024, 13:45

then see the docs for the header api property

Anil Karaniya
14 Apr, 2024, 13:45

are you using Appwrite package for query

Anil Karaniya
14 Apr, 2024, 13:46

if yes then you will have to lower the package version for the queries to work

Anil Karaniya
14 Apr, 2024, 13:46

as it stands the cloud is not on 1.5x version yet

Anil Karaniya
14 Apr, 2024, 13:46

the local version is at 1.5x but not the cloud

flupsiupsi
14 Apr, 2024, 13:47

I’m using the cloud. I don’t use the Appwrite package. I’m using a CLI utility called elm-graphql that builds the query and accepts the headers.

Anil Karaniya
14 Apr, 2024, 13:47

Ook no problem

flupsiupsi
14 Apr, 2024, 13:47

Changed that, and the response is som 404 HTML 😦

Anil Karaniya
14 Apr, 2024, 13:48

what are you fetching from the endpoint

flupsiupsi
14 Apr, 2024, 13:48

with trailing /graphql, there was json with 2 errors and status 200

Anil Karaniya
14 Apr, 2024, 13:48

Okok

flupsiupsi
14 Apr, 2024, 13:48

I am fetching the database schema

Anil Karaniya
14 Apr, 2024, 13:49

Are permissions given proper

flupsiupsi
14 Apr, 2024, 13:49

Not sure… I have set the API token to allow everything.

Anil Karaniya
14 Apr, 2024, 13:50

Set the permissions properly

Anil Karaniya
14 Apr, 2024, 13:50

and then try with the /graphql

flupsiupsi
14 Apr, 2024, 13:55

Is it correct that the API key gives the permissions? On the Appwrite console, the API key scope includes everything. Now I have set all permissions for “Any” role to active for each database table. Still, the errors are the same. Is there another option I need to activate to give permission?

flupsiupsi
14 Apr, 2024, 13:57

Ah I think I found what’s missing!

flupsiupsi
14 Apr, 2024, 13:57
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more