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 8 Next »

Overview

Creates a RestRequest instance.

RestRequest myRestClient.Request()

Creates a new request on client.

RestRequest myRestClient.Request(resource: string)

Creates a RestRequest instance.

RestRequest myRestClient.Request(resource: string, body: ( string | object | Xml ))

Arguments

string resource
to request
( string | object | Xml ) body
Request body.

Remarks

Body argument is optional. If specified request method automatically set to POST, otherwise is set to GET

Xml type of body is automatically detected if specified as Xml or string with starts with "<" and ends with ">" characters.

Example

JSON Request

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

var request = client.Request("file/{id}", {
    field : 'value'
});

request.AddUrlParameter('id',123456);

var result = request.ExecuteJson();

Example

Xml Request

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

var request = client.Request('file/{id}','<root><field>value</field></root>');

request.AddUrlParameter('id',123456);

var result = request.ExecuteXml();
  • No labels