Hi
I have a simple mutation to upload a file however I am not sure if I am using the explorer correctly in trying to run my mutation. I click on add files and select a file but it doesn’t seem like the file is being attached to my variables. This is what my explorer looks like. Can you point me to the documentation around adding files to request variables? Thank you
“message”: “Variable "$file" got invalid value "SampleTradeFile.csv"; Upload value invalid.”,
Hello! To quickly fix this, you should be able to jut pass "file": null
in your variables section & make sure that your key for the attached file matches your variable. In this case you have test
where should be file
.
We could do a better job of communicating this, but let me know if that works for you.
perfect. That worked
Thank you for the help.
Yea I feel like a bit of documentation around this would be helpful since it is not very intuitive.
I have the same problem, the difference is that I need references to the variable of the file to upload with a variable within an input type, that is, it does not receive the file directly as an argument but within the attributes of an input, when I try to do Apollo studio keeps loading and unfortunately the documentation is insufficient. Does anyone know a solution?
did you find any solution?
Worked fine for me… Thank you!
Hey,
Not sure if you found a solution but in case if your input is an object then set the value under the “Variables” tab like so -
input: {
file: null
}
Then, under key, you can set it like -
input.file
I hope it helps.
This is a great new feature, thanks! I was using Postman previously to test GraphQL file uploads, now I can use the Sandbox explorer
Unfortunately for multiple files the variable key seems to be prefixed with the index of the file which breaks the file mapping:
{"0":["0.variables.input.productInputs.0.file"],"1":["1.variables.input.productInputs.1.file"]}
This is what I get, although I used the keys input.productInputs.0.file
and input.productInputs.1.file
. Any reason why this happens? When I have a single file only the key stays the same as the one I typed in.
Hi Mate,
I noticed the exact same behaviour.
The sand box, is broken around this:
should be:
{"0":["variables.input.productInputs.0.file"],"1":["variables.input.productInputs.1.file"]}
A single file it’s perfect, so I’m going to have to postman it no other way.