Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting an example of mutation operation #1

Open
arvindpdmn opened this issue Dec 1, 2020 · 2 comments
Open

Requesting an example of mutation operation #1

arvindpdmn opened this issue Dec 1, 2020 · 2 comments

Comments

@arvindpdmn
Copy link

arvindpdmn commented Dec 1, 2020

Current examples cover query operation. For beginners like me it will be helpful to have a mutation example. Specifically, I tried a few things but getting this error: Error: Failed to start application: Key (query) not found in array and no default was provided.

I gave the following POST request:

POST /api/ HTTP/1.1
Host: localhost
Accept: application/json
Content-Type: application/json
Cache-Control: no-cache
{"mutation":"{ createAcronym({name: 'xxx', description: 'yyy'}) {Acronym {id, name}} }"}

My schema:

input Acronym {
    name: String!
    description: String!
}

type Mutation {
  createAcronym(input: Acronym): Int
}
@arvindpdmn
Copy link
Author

arvindpdmn commented Dec 1, 2020

I found a mutation example here: https://siler.leocavalcante.dev/graphql

@arvindpdmn
Copy link
Author

I figured out the correct syntax: {"query":"mutation { createAcronym(input: {name:\"ABC\", description:\"Abstract Base Class\"}) }"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant