how to handle upload a file in rest assured API testing ?
like u have to use post(/url) and then upload a file at specific paramater.?
Hope this will help, works fine for me
given().
multiPart(KEY, new File(testfile)).
formParam(KEY, testfile).
contentType("multipart/form-data").
expect().
body("user.name", equalTo(someuserdata)).
when().
post(yourapihere);
You can send Multipart data . For Rest assured, its documented here: http://code.google.com/p/rest-assured/wiki/Usage#Multi-part_form_data
Related
How can I upload a file from an external service or app (iOS App, Go App, etc) to a Rails REST API which uses Active Storage local file storage?
All the tutorials I can find use HTML forms. I'd like to upload my files via a POST request to the Rails API. The main thing I am uncertain about is what headers and what kind of format I need to send the files in to the backend.
The solution was to just send normal form-data. I used Postman for testing which works great for file uploads as well http://getpostman.com
Base64 is useful for you, You can decode base64 then generate temp file and upload that file.
I want to upload a file that exists in a telegram server to another server but telegram does not provide a download url link.
I tried to use some bots like pwrtelegrambot or something like that but none of them works.
i tried to write a bot to do this for me but i understand that the bot only can download files up to 20mb and i got this error
{"ok":false,"error_code":400,"description":"Bad Request: file is too big"}
Is there any way to generate download url from the files that exists in telegram server and upload them to another server like uploadboy or something else??
I will appreciate for any help!!
as it mentioned in this link, you can't download files bigger than 20MB.
if you really want to download big files, you should forget about the bots and try to modify telegram clients source codes.(telegram cli , android, webogram)
You can crawl the chat containing your media with a telegram user using thelethon ( python client for telegram ), and download the files one by one using the client.download_media(msg, file_name) function. msg is the telegram message containing the media that you want.
this is a late answer, but just in case anyone faces the same problem ;)
I want to upload a text file to OneDrive API.I don't have any idea about multipart/related. Can any one suggest me how to put below data in postman to upload a file.
I resolved this issue.We need to provide Authorization & Content-Type in header and provide the remaining information in body as raw and select content-type as Text.
I have to send .csv file to remote server through REST in rails.
I had tried post_form of Net::HTTP and made form as multipart true, by this file get transfer (seen in parameters at both side) but at server side i am not able to read it.
It gives error "No such file or directory."
Please any can tell me is there other way to transfer file.
After finding on this and tried many things i got good solution from that i can send csv file by REST web service.
here is solution...
https://github.com/jwagener/httmultiparty
Also can use REST Client for testing purpose.
I'm sort of stuck with a iOS / phonegap question.
I have a XML on the server which I download successful with ajax. I even save the XML in the local storage and can read it later when offline.
The next step is the one where i need a startup. Within the XML I've got image URLs. I would like to download them and save them locally.
What is best practice and also the quickest way?
Do i need the FileWriter plugin for that? Or do i need to save them in a database as base64?
And after that how can i read them to show in the application?
Thanks in advance
There is no simple way as far as i can tell. You may wish to try using the cache manifest, or downloading them using code such as this: http://blog.clearlyinnovative.com/post/2056122828/phonegap-plugin-for-downloading-url-all-the-code
Full project here: https://github.com/aaronksaunders/FileDownLoadApp
Good luck