Skip to content

pass json object as string #10

Open
@draak-krijger

Description

I tried to pass a JSON object as a string through mutation. I'm getting the following error and couldn't manage to fix it,
error: Body: {"errors":[{"message":"Syntax error","locations":[{"line":2,"column":159}],"extensions":{"name":"GraphQLError","time_thrown":"2020-04-09T19:51:20.587Z"}}]}

my code is,

mutation = GQLi::DSL.mutation {
        callConnector(input: {
          connector: "outreach",
          version: "2.8",
          operation: "list_mailboxes",
          authId: "auth_id",
          input: "{\"per_page\":100,\"page\":1,\"sort\":{\"direction\":\"asc\"}}"
        }) {
          output
        }
      }
response = client.execute!(mutation)
response.query.to_gql

It throws error because of stringify JSON value of input field.

I would love some advice about how to properly pass in a JSON string as a query argument.
Thanks!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions