You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Moshe Recanati <re...@gmail.com> on 2017/10/25 17:52:00 UTC

Using CSV for POST json request

Hi,
I've seen tutorial regarding passing variables for POST request using CSV
https://guide.blazemeter.com/hc/en-us/articles/206733689-Usi
ng-CSV-DATA-SET-CONFIG

This is great for simple POST request.

I would like to know how to implement it for complex JSON (body data)
example. for example:

{
  "object": "page",
  "entry": [
    {
      "id": "205408099853466",
      "time": 1508941958327,
      "messaging": [
        {
          "sender": {
            "id": "697363944"
          },
          "recipient": {
            "id": "267347623714743"
          },
          "timestamp": 1508941958168,
          "message": {
            "mid": "mid.$cAAC60WkZtkxlhThUGFfU_MTupd31",
            "seq": 75192,
           * "text": "${text}"*
          }
        }
      ]
    }
  ]
}

while text should be a parameter from a file.

Thank you in advance,
Moshe

Re: Using CSV for POST json request

Posted by Deepak Shetty <sh...@gmail.com>.
You mean you have additional parameters ? They probabkly *should* be query
string parameters in which case  you can direct add them in the URL form in
the PATH text box.
You probably want to take a look at Parameter Handling in
http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request

On Wed, Oct 25, 2017 at 12:53 PM, Moshe Recanati <re...@gmail.com> wrote:

> Thank you but but than i cannot add parameters to the parameters window.
>
> On Oct 25, 2017 10:51 PM, "Deepak Shetty" <sh...@gmail.com> wrote:
>
> > Hi
> > Its the same thing - Use Post Body - copy the JSON there and read the
> > variable ${text} in the same way
> >
> > regards
> > deepak
> >
> >
> > On Wed, Oct 25, 2017 at 10:52 AM, Moshe Recanati <re...@gmail.com>
> > wrote:
> >
> > > Hi,
> > > I've seen tutorial regarding passing variables for POST request using
> CSV
> > > https://guide.blazemeter.com/hc/en-us/articles/206733689-Usi
> > > ng-CSV-DATA-SET-CONFIG
> > >
> > > This is great for simple POST request.
> > >
> > > I would like to know how to implement it for complex JSON (body data)
> > > example. for example:
> > >
> > > {
> > >   "object": "page",
> > >   "entry": [
> > >     {
> > >       "id": "205408099853466",
> > >       "time": 1508941958327,
> > >       "messaging": [
> > >         {
> > >           "sender": {
> > >             "id": "697363944"
> > >           },
> > >           "recipient": {
> > >             "id": "267347623714743"
> > >           },
> > >           "timestamp": 1508941958168,
> > >           "message": {
> > >             "mid": "mid.$cAAC60WkZtkxlhThUGFfU_MTupd31",
> > >             "seq": 75192,
> > >            * "text": "${text}"*
> > >           }
> > >         }
> > >       ]
> > >     }
> > >   ]
> > > }
> > >
> > > while text should be a parameter from a file.
> > >
> > > Thank you in advance,
> > > Moshe
> > >
> >
>

Re: Using CSV for POST json request

Posted by Moshe Recanati <re...@gmail.com>.
Thank you but but than i cannot add parameters to the parameters window.

On Oct 25, 2017 10:51 PM, "Deepak Shetty" <sh...@gmail.com> wrote:

> Hi
> Its the same thing - Use Post Body - copy the JSON there and read the
> variable ${text} in the same way
>
> regards
> deepak
>
>
> On Wed, Oct 25, 2017 at 10:52 AM, Moshe Recanati <re...@gmail.com>
> wrote:
>
> > Hi,
> > I've seen tutorial regarding passing variables for POST request using CSV
> > https://guide.blazemeter.com/hc/en-us/articles/206733689-Usi
> > ng-CSV-DATA-SET-CONFIG
> >
> > This is great for simple POST request.
> >
> > I would like to know how to implement it for complex JSON (body data)
> > example. for example:
> >
> > {
> >   "object": "page",
> >   "entry": [
> >     {
> >       "id": "205408099853466",
> >       "time": 1508941958327,
> >       "messaging": [
> >         {
> >           "sender": {
> >             "id": "697363944"
> >           },
> >           "recipient": {
> >             "id": "267347623714743"
> >           },
> >           "timestamp": 1508941958168,
> >           "message": {
> >             "mid": "mid.$cAAC60WkZtkxlhThUGFfU_MTupd31",
> >             "seq": 75192,
> >            * "text": "${text}"*
> >           }
> >         }
> >       ]
> >     }
> >   ]
> > }
> >
> > while text should be a parameter from a file.
> >
> > Thank you in advance,
> > Moshe
> >
>

Re: Using CSV for POST json request

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
Its the same thing - Use Post Body - copy the JSON there and read the
variable ${text} in the same way

regards
deepak


On Wed, Oct 25, 2017 at 10:52 AM, Moshe Recanati <re...@gmail.com> wrote:

> Hi,
> I've seen tutorial regarding passing variables for POST request using CSV
> https://guide.blazemeter.com/hc/en-us/articles/206733689-Usi
> ng-CSV-DATA-SET-CONFIG
>
> This is great for simple POST request.
>
> I would like to know how to implement it for complex JSON (body data)
> example. for example:
>
> {
>   "object": "page",
>   "entry": [
>     {
>       "id": "205408099853466",
>       "time": 1508941958327,
>       "messaging": [
>         {
>           "sender": {
>             "id": "697363944"
>           },
>           "recipient": {
>             "id": "267347623714743"
>           },
>           "timestamp": 1508941958168,
>           "message": {
>             "mid": "mid.$cAAC60WkZtkxlhThUGFfU_MTupd31",
>             "seq": 75192,
>            * "text": "${text}"*
>           }
>         }
>       ]
>     }
>   ]
> }
>
> while text should be a parameter from a file.
>
> Thank you in advance,
> Moshe
>