Run query from Postman
See original GitHub issueHi guys. First of all, congrats for this very useful lib.
I wrote a very basic mutation for file upload:
class TestMutation(graphene.Mutation):
class Arguments:
sql_file = Upload()
Output = OperationStatusRetType
def mutate(self, info, sql_file_ref):
sql_file = info.context.FILES.get(sql_file_ref)
sql_query_template = sql_file.read().decode('utf-8')
sql_file_names = sql_file.names
in_memory_file = io.StringIO(sql_query_template)
put_s3_object(s3, AWS_DEFAULT_S3_BUCKET, in_memory_file.getvalue(), sql_file_names.split('/')[-1])
return AddDatasetRetType(sqlFilePath=sql_file_names.split('/')[-1],
operationStatus=OperationStatusRetType(success=True))
and I consume it this way:
mutation Test {
testMutation(sql_file: "test.png") {
success
error
}
}
I would like to test it with Postman, posting the file using the POST form-data option, like in the pic:
but I get the error “Must provide query string” as generally in GraphQL the querystring should be in the form body.
In the headers “Content-Type” is “application/graphql”.
Do you know how I can test my GraphQL endpoint using Postman? Also is still not clear to me if I need to assign a value to the Upload field (“sql_file” in this case) or it can be left empty.
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:12
Top Results From Across the Web
Use Postman to Run SQL Queries on Drill Data Sources
You can run Drill queries from Postman, a Chrome browser extension and HTTP client for testing web services. To run Drill queries from...
Read more >Postman to run SQL Queries:. Reading database ... - Medium
Open Command Prompt. · Open the apache-drill- folder. · Go to the bin directory. For example: cd bin · Type the following command...
Read more >Building requests | Postman Learning Center
You can send GraphQL queries with your Postman requests by selecting the GraphQL tab in the request Body. Enter your code in the...
Read more >Databases - Postman
**These setups are typically not something you would run on production, ... to see the full API for how you can query different...
Read more >EXECUTE A SOQL QUERY IN POSTMAN. - Nanostuffs
EXECUTE A SOQL QUERY IN POSTMAN. · 1. Using SOQL query to retrieve data from SF object. · 2. The following query requests...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gj1118 looks like you put the
operations
field in the name section of the file. If we’re following the example verbatim in insomnia, you’ll need to do a multipart post with 3 parameters:operations
with the value{"query": "mutation ($file: Upload) { myUpload(fileIn: $file) { ok }}", "variables": { "file": null }}
map
with the value{ "0": ["variables.file"]}
0
with the file you’re uploading set as the valueAh sorry, didn’t read the entire thing. Since postid is a string, you’ll need to change the postid variable in the operations from null to the string you want, and you can remove all references to “1”