hi please help me for this curl:
curl -X POST
http://10.100.8.22:12000/PodMedad/UploadFile
-H ‘Accept-Language: fa-IR’
-H ‘Accept-Version: 7’
-H ‘Postman-Token: a3bbb1bb-e20a-484b-8985-60df8963679e’
-H ‘cache-control: no-cache’
-F ‘File=@C:\Users\Desktop\download.jpg’
-F Output=file
i try this but i have error in file:
*** Variable ***
${UploadFileUrl} /PodMedad/UploadFile
${file_path} D:\repo\repo\download.jpg
Success UploadFile Result
${file_data}= Get Binary File ${file_path}
${fileDir} ${fileName}= Split Path ${file_path}
${partData1}= Create List ${fileName} ${file_data} download.jpg
Send MultiPart Post Request V.7 without body ${UploadFileUrl} ${file_data}
Hi Fatima,
Well the contents of this keyword and the error message are both missing from, and quite relevant to your question. Without that information we can’t even guess what the problem might be?
I will also comment about windows paths and the use of a single \
:
Reading and understanding Escaping is a good idea, the builtin ${/}
variable is also handy.
Dave.
Dear dave please suggest a correct test case for this curl request:
curl -X POST
http://10.100.8.22:12000/PodMedad/UploadFile
-H ‘Accept-Language: fa-IR’
-H ‘Accept-Version: 7’
-H ‘Postman-Token: a3bbb1bb-e20a-484b-8985-60df8963679e’
-H ‘cache-control: no-cache’
-F ‘File=@C:\Users\Desktop\download.jpg’
-F Output=file
Hi Fatima,
If it were me I’d probably use Create Session in my suite setup and then use POST On Session to actually upload the file because you are probably going to need to test more api calls than just this one?
But if this is the only API call you need to make then you could just use POST.
Either way, you’ll need to set up the header (-H
) and request body (-F
) values (Create Dictionary is useful for this). And it’s worth noting that the details of what the post requests are expecting is documented in GET.
There are examples on this forum for similar file uploads with Requests Library, so search for them and use them as examples.
Dave.
can you help me about this request body with keyword Create dictionay:
-F ‘File=@C:\Users\Desktop\download.jpg’
-F Output=file
i need more help
Hi Fatima,
The way to upload the file seems to vary from app to app, and it’s not something I’ve done myself, but there are examples on the forum of people who’ve succeeded, I’ll give you a few links to look at:
Hopefully one of those will help you.
Dave.