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
  • 0
    Certified Lead Developer

    Hi  

    Couple of questions here:
    1. Is you Web-API trying to store the body data into the database?
    2. If so, does it's Body contain a Date / Date and Time type values converted into JSON format?
    3. If so, try defining it as null for a moment and try executing the WEB-API, but if not then i believe we need to have a look into the logs to understand the root cause behind this exception.

    Also can you please share your JSON Data here so that it will be easy to understand the actual issue.

  • Hi Alok,

    Yes I am trying to store the body data into the database. I am passing text value(for Ex: "name":"Sshithi") as the input into the webapi and then constructing the datatype and then trying to write the constructed type into DB (using a!startprocess(). Using this as i need the Is from this as an input to next CDT) .

    I have issue while invoking the webapi as the syntax for that is | post web api | WEB_API_ENDPOINT | with body | BODY | with username | USERNAME |

    I am currently passing: |with body|{"name": tv!name}| and it is expecting Json format in the |BODY|.
Reply
  • Hi Alok,

    Yes I am trying to store the body data into the database. I am passing text value(for Ex: "name":"Sshithi") as the input into the webapi and then constructing the datatype and then trying to write the constructed type into DB (using a!startprocess(). Using this as i need the Is from this as an input to next CDT) .

    I have issue while invoking the webapi as the syntax for that is | post web api | WEB_API_ENDPOINT | with body | BODY | with username | USERNAME |

    I am currently passing: |with body|{"name": tv!name}| and it is expecting Json format in the |BODY|.
Children
No Data