Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the RestRequest class?

Tags:

c#

.net

mailgun

In the C# tab of the getting started of maingun API, I find the following code.

public static RestResponse SendSimpleMessage() {
       RestClient client = new RestClient();
       client.BaseUrl = "https://api.mailgun.net/v2";
       client.Authenticator =
               new HttpBasicAuthenticator("api",
                                          "key-3ax6xnjp29jd6fds4gc373sgvjxteol0");
       RestRequest request = new RestRequest();
       request.AddParameter("domain",
                            "samples.mailgun.org", ParameterType.UrlSegment);
       request.Resource = "{domain}/messages";
       request.AddParameter("from", "Excited User <[email protected]>");
       request.AddParameter("to", "[email protected]");
       request.AddParameter("to", "[email protected]");
       request.AddParameter("subject", "Hello");
       request.AddParameter("text", "Testing some Mailgun awesomness!");
       request.Method = Method.POST;
       return client.Execute(request);
}

When I google the name of the class, I find several reference to this class in different contexts. However, I can't seem to find the fully qualified name of the RestRequest class anywhere on the mailgun website, google or MSDN to find it's documentation.

Anybody can point out where is this class defined ?

like image 320
Samuel Rossille Avatar asked Jan 24 '13 17:01

Samuel Rossille


People also ask

What is RestRequest in Apex?

If the Apex method has no parameters, then Apex REST copies the HTTP request body into the RestRequest. requestBody property. If there are parameters, then Apex REST attempts to deserialize the data into those parameters and the data won't be deserialized into the RestRequest.

What is RestContext in Salesforce?

RestContext is a predefined class in apex that consist of request and response context variables. With this, I mean that I can access the whole incoming request by using the request context variable of RestContext class. RestRequest is also a predefined apex class which can be used to create/accept an HTTP request.

What is URL mapping in Salesforce?

The URL mapping is relative to https:// instance . salesforce.com/services/apexrest/. A wildcard character (*) may be used. The URL mapping is case-sensitive. A URL mapping for my_url will only match a REST resource containing my_url and not My_Url .


2 Answers

The code looks like it uses RestSharp.

like image 151
Daniel Hilgarth Avatar answered Oct 20 '22 03:10

Daniel Hilgarth


RestSharp is available from NuGet. Install it from there.

like image 44
mcolegro Avatar answered Oct 20 '22 04:10

mcolegro