When I execute my php on a local server its gives a null response, this HAS to be a issue with the code because when I just echo the API I get all the data. Can someone tell me where I go wrong with my code. And please tell me how to fix it, I am trying to learn as much as I can. My plan is to get to total amount of items in a total number and display this number in my html for the time being.
You can’t see the token and other stuff to make a connection for security reasons but the for each loop is where the magic happens. $showHtml is echod in my html document
My graph QL code:
query { boards (ids: xxxxxxxxx) { groups (ids: new_groupxxxx) { id title } items { name id state }}}
To be transparent, I am not much of a PHP developer myself. That said, looking at the GraphQL query you are using, it seems like you are inserting a specific group ID in the request. This Group ID might not exist within that specific board, which is why you are getting a “null” response.
You’ve mentioned making the exact same query using our API playground works for you, is that correct? You might experience the behavior since you are using a forEach loop, and this StackOverFlow thread suggests using "while’ instead.
I deleted this post because everything works know, you were right the group id was rong. Instead of groups (ids: new_groupxxxx) I had to do groups (ids: “new_groupxxxx”). Small but devastating if not properly done. Will graphQL get updates in the future to be less sensitive to these mistakes?
I’m glad you were able to find the solution here! I’m afraid the group ID value is always expected to be formatted as a string when sent to our API, and I do not think this is subject to change in the nearest future.