Unanswered question

I need to create a POST request and have to pass excel file in body?

I need to create a POST request and have to pass excel file in its body as a parameter, which needs to be changed with every iteration , please suggest?

Anshika K.
Anshika K.

Anshika K.

Level
0
26 / 100
points

Answers

You can look at this post here where it is explained how to use a POST request with an external source file.

Basically you need to copy your excel file in the custom-resources folder and in your POST binary request in the Source File field ${NL-CustomResources}\${Myfiles.file}.xls.

Your NeoLoad variable Myfiles will contain a file column where you have the list of file names without the xls extension.

Anshika K.
Anshika K.

Anshika K.

Level
0
26 / 100
points

Thanks Nouredine for your response. Please find snapshot for setting that I have done to create request. However , I am getting error as '{"error":"Invalid File type. Please provide a csv file."},. Please suggest if any thing is incorrect here..

Fousseyni B.
Fousseyni B.

Fousseyni B.

Level
2
1014 / 2000
points

Hello Anshika K.

The error message is saying that your variable type is not a csv.
Indeed, you are using List type variable instead of file Type variable.
Put the list of your files in a csv file and create file type variable on Neoload.

Best Regards,
Fousseyni B.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

List variable type should be fine as it a list of filenames, could it be you are missing the full filename (see screenshot)

Anshika K.
Anshika K.

Anshika K.

Level
0
26 / 100
points

I tried passing it as file type variable and also trioed adding .csv at the end of file name still same error

Could the issue be with the "Content-Type" field that is empty in your request?

Maybe the server expects a specific content type here but you did not put anything.

You could try "application/vnd.ms-excel" or "text/csv".