I want to send below as a form-data in API Body for a PUT request:
Upload a file(KEY) with "Error.png"(VALUE)
Send text, "MyName"(KEY) with false(VALUE)
How to do this using REST-Assured
I don't seem to understand the question completely, but if you're trying to upload a file then you can use
given().multiPart("file2", new File("/home/test/some_large_file.bin"))
If you wish to send the file as as a RAW data you can use Tool to encode the file and send the value in the payload
Related
I need to send a PDF file with a value (basically a String) to an .ASP endpoint.
I know how to fetch a file with UIDocumentPickerViewController and how to transform it as a Data object. I've also red this thread as a start to send a file to an endpoint, but I don't know how to send another value alongside with the file.
Thanks for your help.
I have a rails-api project, which provide the api to access my data.
I use carrierwave to store my file, my model called User and file attribute called image.
So, the image attribute contained the file_name, url and some other info.
In order to translate the file through the api, I added the gem carrierwave-base64.
I understand the Upload process. The client app encode the file to base64 code, then sent to backend by a json message. For example:
{user: {email: "test#email.com", image: "data:image/jpg;base64,#{base64_image}"}
So when the backend receive the json request, the carrierwave will parse the base64 code to a file and store it to local or S3
What I do not understand, is the Download process:
When I request the user info, what I assume is that the image file would be transfered as a base64 code in a json message, and then the client app will encode the base64 code to a file(image), and then display.
But actually, what I can provide for the json data, is the file url, not the base64 code.
The reason I want to get the file(image) from the api-server is because I don't want to the client app directly access s3 by url. So every time when the client app want to get a file, it will request the api-server, and api-server will get the file and transfer to the client.
Does anyone can explain how to do the download?
Or if I was thought in a wrong strategy, that I need another api endpoint to response a file object, not just accompany with user model.
Cheers.
Restricting Access to Objects Stored on Amazon S3
https://github.com/thoughtbot/paperclip/wiki/Restricting-Access-to-Objects-Stored-on-Amazon-S3
you did a good thing with uploading ,But while downloading you need to send URL no base64 and its traditional
Also for securrity purpose you can put public read permission on s3 while uploading and use expiring_url(60, :thumb) for your clients
In this URL get expired in time that you have specified
How to work with this kind of server
http://136.243.3.6:8888/wsLoyalty/Loyalty.1cws?wsdl
I mean how to response, request and so on
You need to create a soap envelope to send request and will need to use XML parsing to read response
Refer this
I am working on an application for iOS which needs to synchronize data between multiple users and one web server.
I did some research and the best solution I found for this is working with JSON.
At the moment I have a .json file on a web server and I am able to download the data to my iphone app and parse it.
I have two problems I didn't manage to understand yet:
1. How can each iphone user write back data to the json file on the server?
2. How can I take a data table and automaticly convert it to a .json file? so the .json file on the server will be updated every few minutes or so...
I'll appreciate any help with this!
You dont send JSON file as afile to the devices, you send a JSON request, I advice to do more reading about this topic, you can start from below:
Working with JSON in iOS 5 Tutorial
enter link description How to make HTTP request from iPhone and parse JSON result
How to fetch and parse JSON by using data models
and read this SO question:
iPhone/iOS JSON parsing tutorial
How to sent JSON request in the Post method in iPhone?
How to send json data in the Http request using NSURLRequest
Is it possible to POST "url encoded" parameters to a remote web service instead of JSON or XML ?
My rails application consumes a web service which takes URL encoded parameters (content-type: application/x-www-form-urlencoded) in POST requests and give JSON answers.
Is this kind of RESTful services common ?
When you make a hit to a JSON or XML web service using Ajax then the parameters are just getting encoded as either GET or POST, and is typically sent using the application/x-www-form-urlencoded content type anyway (see http://api.jquery.com/jQuery.ajax/ for an example specific to jQuery).
So, basically, yes, it is possible to send data in any format (JSON, XML, BSON etc.) in this manner.