How to send a file in the request body for GraphQL API and Spring-boot application using postman?

How to send a file in the request body for GraphQL API and Spring-boot application using postman?


0

I am using graphQL for my APIs and now I need to receive a file in the request as a multipart file, so how to send that file using Postman to my controller?

@Data
public class FileDTO {
    private MultipartFile smsFile;
}
@Controller
public class SMSBulkController {
    @Autowired
    ParsingService parsingService;

    @MutationMapping
    public ApiResponse<String> uploadFile(@Argument FileDTO file) throws IOException {
        parsingService.upload(file);
        return ApiResponse.success("success");
    }
}

and this is my graphql file:

scalar Upload
input smsFileInput{
    smsFile: Upload
}
type Mutation{upload(file: smsFileInput):MutateApiResponse}


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *