Need specific data from response message

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Need specific data from response message

praveen tiwari
Hi All,

I am getting response for a API request and able to save it in JSON file
using save response to a file listener.
I need to fetch only specific records from response message. E.g. in
response their are 10 parameters but I need to save only 4 parameters in
file.
Any help would be highly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Need specific data from response message

ra0077
Hi,

You can use an Extractor (for example an JSON Extractor) and save it in a
file

Antonio

2017-11-06 15:55 GMT+01:00 praveen tiwari <[hidden email]>:

> Hi All,
>
> I am getting response for a API request and able to save it in JSON file
> using save response to a file listener.
> I need to fetch only specific records from response message. E.g. in
> response their are 10 parameters but I need to save only 4 parameters in
> file.
> Any help would be highly appreciated.
>
Reply | Threaded
Open this post in threaded view
|

Re: Need specific data from response message

praveen tiwari
Hi,

But where I can define the filename where I need to save data in JSON path
post-processor?

On 06-Nov-2017 8:46 pm, "Antonio Gomes Rodrigues" <[hidden email]> wrote:

> Hi,
>
> You can use an Extractor (for example an JSON Extractor) and save it in a
> file
>
> Antonio
>
> 2017-11-06 15:55 GMT+01:00 praveen tiwari <[hidden email]>:
>
> > Hi All,
> >
> > I am getting response for a API request and able to save it in JSON file
> > using save response to a file listener.
> > I need to fetch only specific records from response message. E.g. in
> > response their are 10 parameters but I need to save only 4 parameters in
> > file.
> > Any help would be highly appreciated.
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Need specific data from response message

niraj
I would suggest you Regex may be to extract required data then use
Beanshell Postporcessor where you can define File name and location. Then
call extraced variable in Beanshell and write into file.

On Mon, 6 Nov 2017 at 9:15 PM, praveen tiwari <[hidden email]>
wrote:

> Hi,
>
> But where I can define the filename where I need to save data in JSON path
> post-processor?
>
> On 06-Nov-2017 8:46 pm, "Antonio Gomes Rodrigues" <[hidden email]>
> wrote:
>
> > Hi,
> >
> > You can use an Extractor (for example an JSON Extractor) and save it in a
> > file
> >
> > Antonio
> >
> > 2017-11-06 15:55 GMT+01:00 praveen tiwari <[hidden email]>:
> >
> > > Hi All,
> > >
> > > I am getting response for a API request and able to save it in JSON
> file
> > > using save response to a file listener.
> > > I need to fetch only specific records from response message. E.g. in
> > > response their are 10 parameters but I need to save only 4 parameters
> in
> > > file.
> > > Any help would be highly appreciated.
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

RE: Need specific data from response message

Stuart Kenworthy
In reply to this post by praveen tiwari
If using jmeter3.0 or above, you can use a groovy.json.JsonSlurper in a groovy JSR223 post processor/sampler/assertion to pull out specific Json elements then output to file.

-----Original Message-----
From: praveen tiwari [mailto:[hidden email]]
Sent: 06 November 2017 14:56
To: JMeter Users List <[hidden email]>
Subject: Need specific data from response message

Hi All,

I am getting response for a API request and able to save it in JSON file using save response to a file listener.
I need to fetch only specific records from response message. E.g. in response their are 10 parameters but I need to save only 4 parameters in file.
Any help would be highly appreciated.

The information included in this email and any files transmitted with it may contain information that is confidential and it must not be used by, or its contents or attachments copied or disclosed to, persons other than the intended addressee. If you have received this email in error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant standard terms of contract for any work to be undertaken will apply. Please carry out virus or such other checks as you consider appropriate in respect of this email. BJSS does not accept responsibility for any adverse effect upon your system or data in relation to this email or any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor, Coronet House, Queen Street, Leeds, LS1 2TW.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need specific data from response message

glinius@live.com
In reply to this post by praveen tiwari
I would recommend the following approach:

 1.  JSON Extractor
<http://jmeter.apache.org/usermanual/component_reference.html#JSON_Extractor>  
to fetch "interesting" values from the response
 2.  Sample Variables
<http://jmeter.apache.org/usermanual/listeners.html#sample_variables>  
property to store the results in .jtl results file

Given you have JMeter Variables like *var1*, *var2*, *var3* and *var4* you
can add the next line to /user.properties/ file (located in "bin" folder of
your JMeter installation)


> sample_variables=var1,var2,var3,var4
*

And next time you run your test you will see 4 extra columns in the .jtl
results file holding the values of the aforementioned variables for each
sampler.

See  Configuring JMeter
<http://jmeter.apache.org/usermanual/get-started.html#configuring_jmeter>  
and  Apache JMeter Properties Customization Guide
<https://www.blazemeter.com/blog/apache-jmeter-properties-customization>  
guides for more information on JMeter fine tuning using properties.



--
Sent from: http://www.jmeter-archive.org/JMeter-User-f512775.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]