Trouble attaching file in postman for testing spring boot restapi - spring-boot

I have written code for uploading file in spring boot , when I test it , I get status 200 ok , but the file is not getting uploaded . Can some one help me on this . Below is the code , I can see the sysout from the method in controller is being printed but after that the length is being printed as zero. I would further like to add that the uploadFile method is working i.e., the method which takes single file works as expected , but the method which is written to upload multiple files is not working as expected and I see the length of list of Multipart file is being printed as zero .
Java Code:
postman test :
enter image description here
postman console :
enter image description here
postman console 2 :
enter image description here
filestogeservice storefile method

Related

Inconsistent functionality on CommentThreads: insert on Youtube DATA API

i could need some help with the Youtube data API , i have a server in which utilizes the Youtube API in adding a youtube comment using JS , it's quiet simple :
const snippet = {
snippet: {
videoId:videoId,
topLevelComment:{
snippet:{
textOriginal:message
}
}
}
};
axios({
method: 'POST',
url: 'https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&alt=json&access_token='+access_token,
data : snippet
})
This used to work without any issues , but since yesterday, it stopped working , giving me this error :
"code": 400,
"message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request's input is invalid. Check the structure of the <code>commentThread</code> resource in the request body to ensure that it is valid."
Now the bizarre thing is that , testing in a sandbox online with an axios client , this works , i tried with postman , it works , in the youtube code sample sandbox , it works and i'm able to add the comment using an access token , but in my server , it fails even though all of the data is passing correctly , it fails , even tho it is the exacty same request , giving me that error..
My server is hosted on heroku.
The quota limit is not reached , it is far from reached sine the api is only used once in a while.
I tried passing my API Key , but it's the same with or without it in all the above cases.
I don't know what to do from this point i'm utterly confused.
Any help would be appreciated , thank you.

Download file with angular 5 and Spring boot

I'm trying to download a file from a specific directory everything works fine in the back-end when I test the service, but when I try it from the front-end I get this error and the pop/up save doesn't show.
Here's my back-end code with spring boot :
enter image description here
and my front with angular 5 looks like this
enter image description here
the service :
enter image description here
After your
respHeaders.setContentType(MediaType.APPLICATION_PDF);
Try adding this:
respHeaders.add("Content-Disposition", "attachment; filename=\"file.pdf\"");

How to get Uploaded Url of a Video File in android using Parse REST API

I am using Parse Mobile Backend for my android app,but whenever I want to upload a large video more than the default 10mb limit for a ParseFileby getting the bytes from it into a ParseFile I keep running into the dreaded OutOfMemory Exception .So,I want to use the Parse REST API since I can easily use the setChunkedStreamingMode(1024) in HttpUrlConnectionto send the bytes in a chunked manner.The trouble is,how do I get the uploaded url of the file uploaded.Thanks for your help in advance.
i think you can use getUrl() method
ParseFile file = new ParseFile(byte[] data);
file.getUrl();
ParseFile object has getUrl() method to getting url of file. this method return URL in string format.

Google Place API error when I used in cpp project or with curl command

Recently I started working with Google Place API. I have created one server key for my current project. As I have to use Place API so I turned it on in Service page.
When I am using the following URL in my browser, I get the desired output in the browser.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY
But if I use the URL above in my current C++ project or with the curl command on ubuntu terminal, I get the following error.
{
"error_message" : "An internal error was found for this API project.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
What should I do to correct this behaviour?
if you used the uri
https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY
you sending a request to google, logging for the account with the key 'MY_API_KEY'
i guess you need to register for a key and use it as parameter value

JMeter - File upload and file download scenario

I am using JMeter to do performance test a web page.
I have a scenario for uploading a file and downloading a file. I need to load test uploading file and downloading file scenarios.
Can any one help me how to achieve these using JMeter.
Thanks,
Raj
There are actually no difficulties in recording upload/download traffic with any HTTP sniffing tool and then emulate recorded requests in using JMeter.
In the simplest case you will get something like the following:
Thread Group to setup number of test users and loops;
for upload: 1 HTTP POST request with Use multipart/form-data for POST = true - to sent file as part of request;
for download: 1 HTTP GET request for download + Save Responses to a file listener attached to it - to save requested file.
This will look like the following:
Thread Group
Number of Threads = X
Loop Count = Y
. . .
UPLOAD HTTP Request
Method = POST
Use multipart/form-data for POST = true
-- Send Files with Request -- section:
File Path = ${testFile}
Parameter Name = datafile
MIME Type = ...
. . .
DOWNLOAD HTTP Request
Method = GET
Save Responses to a file
Filename Prefix = downloadTest_
Variable Name = testFile
. . .
Here you can find sample script implemented for schema given above: file-upload-download.jmx.
The following posts may also appear useful:
Testing load document functionality with JMeter
Performance testing: Upload and Download Scenarios with Apache JMeter
How to Test Image Upload Functionality With JMeter
JMeter Testing Multiple Random File Uploads
Handling File Upload in JMeter

Resources