0

I have a graphql-server that is running at localhost:3001 I want to send files to a python flask server together with some variables in a cURL request. Here is what i'm sending

curl http://localhost:3001/graphql/  -F operations='{ "query": "mutation ConvertDocToPDF($input: ConvertWordDocToPDFInputType!){ convertDocToPDF(input: $input){ success } } ", "variables": { "input" : { "file": null, "saveName": "hello" } ] } }' -F map='{ "0": ["variables.input.file"] }' -F 0=@README.md

Surprisingly I'm getting an error which says:

json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 188 (char 187)
[11/Jan/2023 09:38:31] "POST /graphql/ HTTP/1.1" 500 107387

What may be the problem in this request. Any help input will be appreciated

crispengari
  • 7,901
  • 7
  • 45
  • 53
  • 1
    i don't know JSON, but maybe it's bad format cause one-line code, maybe this works? `curl http://localhost:3001/graphql/ -F operations='{"query":"mutation ConvertDocToPDF($input: ConvertWordDocToPDFInputType!){ convertDocToPDF(input: $input){ success }","variables":{"input":{"file":null,"saveName":"hello"}}}' -F map='{ "0": ["variables.input.file"] }' -F 0=@README.md` – whoami Jan 11 '23 at 08:14
  • @whoami Thanks mate for the suggestion i saw the problem. It was suppose to be `curl http://localhost:3001/graphql/ -F operations='{ "query": "mutation ConvertDocToPDF($input: ConvertWordDocToPDFInputType!){ convertDocToPDF(input: $input){ success } } ", "variables": { "input" : { "file": null, "saveName": "hello" } } }' -F map='{ "0": ["variables.input.file"] }' -F 0=@README.md` without `]` – crispengari Jan 11 '23 at 08:29
  • 1
    Yes, one-line can trick our eyes ;) – whoami Jan 11 '23 at 08:30

0 Answers0