Having issue creating a MoneyTransactionCreateInput
PabloEsco
Member Posts: 1
Following this action [https://developer.waveapps.com/hc/en-us/articles/360019968212-API-Reference#moneytransactioncreateinput]
I'm using Python requests to connect with Wave API.
query = """ mutation ($input: MoneyTransactionCreateInput!) {moneyTransactionCreate(input: $input) {moneyTransaction {id externalId date description anchor{accountId amount direction} lineItems[{accountId amount balance}]}}}""" moneyTransaction = {'businessId':'5ODAtNzQ3OS00ZGQ4LTg5NWYtMzU4ZWNiNDNmMTI2', 'externalId':'21', 'date':'2020-05-16', 'description':'my money', 'anchor':{'accountId':'1', 'amount':'15.00', 'direction':'DEPOSIT'}, 'lineItems':[{'accountId':'1', 'amount':'15.00', 'balance':'CREDIT'}]} variables = {'input': moneyTransaction} rex = requests.post(wave_url, json={'query':query, 'variables':variables}, headers=after_headers)
I got this error:
'{"errors":[{"extensions":{"id":"e6b88a8d-a5f8-4331-80db-191dbb319690","code":"GRAPHQL_PARSE_FAILED"},"message":"Syntax Error: Expected Name, found [","locations":[{"line":1,"column":183}]}]}\n'
I'm missing something but can't figure out the issue. I'm new to Graphql.
0
Comments
Hi @PabloEsco,
Can you try changing the mutation definition you are submitting. Try replacing
moneyTransaction {id externalId date description anchor{accountId amount direction} lineItems[{accountId amount balance}]}
withtransaction { id }
. This portion is about describing the data to be returned upon completion and needs to be something the server allows to be returned.Here is the operation formatted for human readability, although it can be condensed as you have done originally.
Mutation:
Variables:
There is the Playground tool that can be used to try to help build and run queries/mutations in case you are unsure about the validity of the operation.