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

How to pass json to the rest api

SOLVED
Highlighted
Level 1

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?

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to pass json to the rest api

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 4

Re: How to pass json to the rest api

Re: How to pass json to the rest api

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

Re: How to pass json to the rest api

Hi Stephane,

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

Re: How to pass json to the rest api

Thanks it worked