Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Adds a new parameter to request body.

RestRequest myRestRequest.AddParameter(name: string, value: object)

Adds a new parameter to request body.

RestRequest myRestRequest.AddParameter(name: string, value: object, type: ( "Cookie" | "GetOrPost" | "UrlSegment" | "HttpHeader" | "RequestBody" | "QueryString" | "QueryStringWithoutEncode" ))

Arguments

string name
Name of parameter
object value
Value of parameter
( "Cookie" | "GetOrPost" | "UrlSegment" | "HttpHeader" | "RequestBody" | "QueryString" | "QueryStringWithoutEncode" ) type
Type of parameter. Optional.

Remarks

Name and value arguments are required.

Type parameter is optional. If not specified default value is "GetOrPost".

Type parameter can be one of following;

GetOrPost

Cookie

HttpHeader

RequestBody

QueryString

Example

var client = $Rest.Create('http://targetserver');
var request = client.Request();

request.AddParameter('x', 1);
request.AddParameter('y', {
  z : 3
});

// request body as
// {
//    "x" : 1,
//    "y" : {
//        "z" : 3
//    }
// }

var response = request.ExecuteJson();

Remarks

Name and value arguments are required.

Type parameter is optional. If not specified default value is "GetOrPost".

Type parameter can be one of following;

GetOrPost

Cookie

HttpHeader

RequestBody

QueryString

Example

var client = $Rest.Create('http://targetserver');
var request = client.Request();

request.AddParameter('x', 1);
request.AddParameter('y', {
  z : 3
});

// request body as
// {
//    "x" : 1,
//    "y" : {
//        "z" : 3
//    }
// }

var response = request.ExecuteJson();

Examples

var client = $Rest.Create('http://targetserver');
var request = client.Request();

request.AddParameter('x', 1);
request.AddParameter('y', {
  z : 3
});

// request body as
// {
//    "x" : 1,
//    "y" : {
//        "z" : 3
//    }
// }

var response = request.ExecuteJson();
  • No labels