cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

How to pass json to the rest api

nbhagtani
2-Guest

How to pass json to the rest api

I have got json to pass to the rest api.

created json:

{

  "Path": "sample string 1",

  "Name": "sample string 2",

  "Value": "sample string 3",

  "TimeStamp": "sample string 4"

}

if am using postJson method how to pass above json to PostJson  method?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Nisha,

Just populate the content parameter with your Json.

For example :

var myJson = {

  "Path": "sample string 1",

  "Name": "sample string 2",

  "Value": "sample string 3",

  "TimeStamp": "sample string 4"

};

var params = {

    headers: myHeader /* JSON */,

    url: myUrl /* STRING */,

    content: myJson /* JSON */,

};

// result: JSON

var result = Resources["ContentLoaderFunctions"].PostJSON(params);

View solution in original post

4 REPLIES 4
posipova
20-Turquoise
(To:nbhagtani)

Hi Nisha,

Just populate the content parameter with your Json.

For example :

var myJson = {

  "Path": "sample string 1",

  "Name": "sample string 2",

  "Value": "sample string 3",

  "TimeStamp": "sample string 4"

};

var params = {

    headers: myHeader /* JSON */,

    url: myUrl /* STRING */,

    content: myJson /* JSON */,

};

// result: JSON

var result = Resources["ContentLoaderFunctions"].PostJSON(params);

Hi Stephane,

if my rest service is returning boolean so will i get that in result using PostJson?

Thanks it worked

Top Tags