Using CSV for POST json request

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

Using CSV for POST json request

Moshe Recanati
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
Reply | Threaded
Open this post in threaded view
|

Re: Using CSV for POST json request

shettyd
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 <[hidden email]> 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
>
Reply | Threaded
Open this post in threaded view
|

Re: Using CSV for POST json request

Moshe Recanati
Thank you but but than i cannot add parameters to the parameters window.

On Oct 25, 2017 10:51 PM, "Deepak Shetty" <[hidden email]> 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 <[hidden email]>
> 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
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Using CSV for POST json request

shettyd
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 <[hidden email]> wrote:

> Thank you but but than i cannot add parameters to the parameters window.
>
> On Oct 25, 2017 10:51 PM, "Deepak Shetty" <[hidden email]> 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 <[hidden email]>
> > 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
> > >
> >
>