Passing values in json format

Hi All,

I have a requirement where i have to pass the value from variable into the webapi . I am receiving 500 error as the following code is not in Json format.

|post web api | testWebapi | with body |{"var1":tv!variable} |with username| testUsername

Did anyone of you face similar issue and how do we pass the tv!variable in Json Format.

Thanks In advance

Regards,

Sahithi

  Discussion posts and replies are publicly visible

Parents
  • Hi Shanmukha & ravalik,

    I am trying to call a webapi from Fitnesse. The syntax for this is
    | post web api | WEB_API_ENDPOINT | with body | BODY | with username | USERNAME |

    for the fitnesse to execute this step , I should be passing the values for the body in Json Format similar to
    | post web api | testwebapi | with body | {"id":"1", "Name":"Sahithi"} | with username | testUsername |

    But in my scenario i have values already generated in previous steps and stored in a variable.
    For Eg: tv!name has the value "Sahithi"
    So now i should be passing this as
    | post web api | testwebapi | with body | {"id":"1", "Name":tv!name} | with username | testUsername |

    The above syntax throws 500 error as the variable tv!name is not considered to be in Json Format for the input.

    So i was seeking help if anyone had similar situation and is able to help me.
Reply
  • Hi Shanmukha & ravalik,

    I am trying to call a webapi from Fitnesse. The syntax for this is
    | post web api | WEB_API_ENDPOINT | with body | BODY | with username | USERNAME |

    for the fitnesse to execute this step , I should be passing the values for the body in Json Format similar to
    | post web api | testwebapi | with body | {"id":"1", "Name":"Sahithi"} | with username | testUsername |

    But in my scenario i have values already generated in previous steps and stored in a variable.
    For Eg: tv!name has the value "Sahithi"
    So now i should be passing this as
    | post web api | testwebapi | with body | {"id":"1", "Name":tv!name} | with username | testUsername |

    The above syntax throws 500 error as the variable tv!name is not considered to be in Json Format for the input.

    So i was seeking help if anyone had similar situation and is able to help me.
Children