Skip to content

Post

Performs the request using the POST method.

1
myRestRequest.Post():RestResponse

Returns

A RestResponse instance containing the server's response.

Remarks

This method expects the response status code to be OK (200), Accepted (202), or No Content (204), unless RestRequest.Expect is used. Services that answer Created (201) need Expect('Created').

Examples

Create a resource

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var created = $Rest.Create('https://api.example.com/')
    .Request('tickets', {
        title : $Xml.Evaluate('Subject'),
        reporter : $Initiator ? $Initiator.Name : ''
    })
    .Expect('Created')
    .Post()
    .ToJson();

$Xml.SetValue('TicketId', created['id']);

See Also