1
votes

I using apollo server, and have this mutation :

mutation {
  updateData(
    file1: fileOne,
    file2: fileTwo,
    file3: fileThree,
    payload: {
      id: "7e3583b4-5673-48df-a3cf-44a4ec33f0e1"
    }
  ){
    isSuccess
    error
    data
  }
}

I want to test it using postman, because i didnt find any clue test it using graphql playground.

I already find how to test graphql from postman, but it doesn't contains information about file upload. graphql postman

I have an idea from apollo-upload-client to post using multipart-formdata but it still fail.

please help how to test graphql with apollo server for upload file mutation using postman?

thanks

1
Are you fixed on Postman or can you try another REST client? I know how to do this using Insomnia - it is not a very pretty solution but it has worked for me. I vaguely recall having trouble achieving this on Postman altogether due to some bug or limitation in Postman.Avius
i found some clue from internet and it works, using postman formdata must add multer on server.yozawiratama
@Avius Can u pls help me with insomina ? how to do it there ?Sushilzzz
@yozawiratama can you please let us know your solution as I am in the same issue and need someone to helpKrunal Shah
okay, sorry for late replyyozawiratama

1 Answers

0
votes

I need to understand about how file upload works in node js (because I use nodejs ini this case)

  1. I install multer for file upload middleware using nodejs and expressjs, if you use other framework or programming language, just try adjust it
  2. In postman I use formdata

you can find the good step by step here

Upload file graphql using postman