Problem with escaped charcters and GraphQL query

Hi,

I have the following request which works on the GraphQL api explorer:

query{
  repository(owner: "devolution2409", name: "Lidl-Soundboard") {
    releases(last: 2) {
      edges {
        node {
          description,
          isPrerelease,
          tag {
            id,
            name
          }
        }
      }
    }
  }
}

However, i want to implement this in Qt (or at least, make it work through cUrl)

Whenever i try escaping this request, i get the following error

“{“message”:“Problems parsing JSON”,“documentation_url”:”[https://developer.github.com/v4](https://developer.github.com/v4)"}"

Thing is, i tried the example provided on the documentation that just shows who’s connected, with the header correctly set as my access token and it is working, in both my qt app and cUrl.

I then tried the following query:

query{
  repository(owner: "devolution2409", name: "Lidl-Soundboard") {
    id
  }
}

Which didn’t work in either qt app or cUrl, again.

I think i’m escaping character incorrectly, any help would be appreciated :slight_smile:

I haven’t used Qt, but this worked for me in curl:

curl -H "Authorization: bearer TOKEN_REDACTED" -X POST -d " \
> { \"query\": \"query{repository(owner: \\\"devolution2409\\\", name: \\\"Lidl-Soundboard\\\") {releases(last: 2) {edges {node {description, isPrerelease, tag {id, name}}}}}}\" } \
> " https://api.github.com/graphql

which returned:

{"data":{"repository":{"releases":{"edges":[{"node":{"description":" *1.8.0 Release: Lazy Laden*\r\n\r\n **New Features** \r\n+ New playback mode: *sequential auto loop*, allows for a sound to repeat it self automatically (#6).\r\n\r\n **Quality of Life** \r\n+ Remove singleton mode, as it was redundant with Sequential containing only one sound (#8). \r\n+ Shortcut will now not play the associated sound if you are currently editing a sound (#10).\r\n+ Shortcut using numbers located on the num pad will now be displayed as \"Numpad\" in the main UI (#11). The following *can't* be done with numpad_end and the like because of how windows treats those key (basically, the same as the non-numpad counterpart)\r\n\r\n\r\nI'll add installer once i found out how again LUL\r\n","isPrerelease":false,"tag":{"id":"MDM6UmVmMTMyMDI5NjI0OjEuOC4w","name":"1.8.0"}}},{"node":{"description":"1.9.0 Release:\r\n\r\nNew Features:\r\n\r\nImplemented Profiles (#14).\r\nImplemetend Game detection.\r\n\r\nSoundboard now has an undeletable, uneditable profile called \"Default\".\r\nYou can add profiles using the dedicated UI. \r\nA profile consists of a name, which is mandatory, and an optional list of executable.\r\n\r\nThe soundboard will listen to windows events in order to detect games.\r\nOnce a game has been detected, the associated profile will be automatically loaded and will change the following:\r\n - Sounds (and their associated shortcut and SFX)\r\n - Push To Talk Key to Auto-Hold\r\n\r\nOutput devices, aswell as the stop key will remain the same.\r\n\r\n\r\n\r\n(see #14 for details of implementation i guess)","isPrerelease":true,"tag":{"id":"MDM6UmVmMTMyMDI5NjI0OjEuOS4wLWFscGhh","name":"1.9.0-alpha"}}}]}}}}

Some things to check:
Are you creating a json doc ?

{"query": "your explorer query string"}

Are you escaping the quotes within “your explorer query string” to create valid json?
If you are using curl from a shell, are you escaping the json quotes and backslashes?
Hopefully this helps a bit.

1 Like