Skip to main content
1-Visitor
July 25, 2017
Solved

How to pass json to the rest api

  • July 25, 2017
  • 4 replies
  • 4542 views

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?

Best answer by smainente

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);

4 replies

20-Turquoise
July 25, 2017
smainente16-PearlAnswer
16-Pearl
July 25, 2017

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);

nbhagtani1-VisitorAuthor
1-Visitor
July 25, 2017

Hi Stephane,

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