Sorry, you need to enable JavaScript to visit this website.

You are here

C# RestSharp Incompatiability

2 posts / 0 new
Last post

Lee's picture
by Lee

C# RestSharp Incompatiability

I am trying to use the C# RestSharp functions which (using PostMan and other tools relies on Version 105.1.0

However, this version has been depreciated and has been replaced by a new version due to security notices.

Running the new framework, results in an invalid JSON code.

Can this be looked into please.


namespace TestAppX48
    internal class Program
        static void Main(string[] args)
            var client = new RestClient(;
            var request = new RestRequest("oauth/token", Method.Post);
            request002EAddHeader("Content-Type", "application/x-www-form-urlencoded");
            request.AddParameter("client_id", "xxxxxxxxxxxxxxxxxxxxxxxxxx");
            request.AddParameter("client_secret", "xxxxxxxxxxxx");
            request.AddParameter("grant_type", "client_credentials");
            request.AddParameter("scope", "");
            Task<RestResponse> response = client.ExecuteAsync(request);

            var requestSend = new RestRequest("messages/sms", Method.Post);
            requestSend002EAddHeader("Accept", "application/json");
            requestSend002EAddHeader("Content-Type", "application/json");
            requestSend002EAddHeader("Authorization", $"Bearer xxxxxxxxxxxxxxxxx");
            var body = @"{
" + "\n" +
            @"    ""to"": ""+61xxxxxxxx"",
" + "\n" +
            @"    ""validity"": ""60"",
" + "\n" +
            @"    ""priority"": false,
" + "\n" +
            @"    ""notifyURL"": "http://YOUR_URL/",
" + "\n" +
            @"    ""body"": ""Message text goes here""
" + "\n" +
            requestSend.AddParameter("application/json", body, ParameterType.RequestBody);
            Task<RestResponse> responseSend = client.ExecuteAsync(requestSend);

                "message":"Refer to API docs at"

Asha's picture
by Asha

Do you still need help with

Do you still need help with this Lee?

Log in or register to post comments