Giter Site home page Giter Site logo

Comments (8)

tylerlong avatar tylerlong commented on June 5, 2024

I don't think you are using the official SDK. Because your code seems very strange to me:

var ringCentral = new RingCentral.XDK.ApiClient(appkey, appsecret,defaultendpoint);

Please read the readme file for the sample code: https://github.com/ringcentral/ringcentral-csharp-client

This project is currently in beta, we have another project which is stable: https://github.com/ringcentral/ringcentral-csharp

You code uses neither of the two above, so we cannot provide any more comments.

from ringcentral-csharp-client.

shashank0764 avatar shashank0764 commented on June 5, 2024

Hello Tyler,
Thanks for the information i am now using the new SDK which you mentioned in the second link but it is giving me an error while login, please check the attachment.
smsloginerror

from ringcentral-csharp-client.

shashank0764 avatar shashank0764 commented on June 5, 2024

Hello Tyler,

Below is the code i use

         sdk = new SDK(appKey, appSecret, SDK.Server.Sandbox, "C Sharp Test Suite", "1.0.0");
        // mock test only, don't contact remote server
        sdk.Platform._client = new HttpClient(new RingCentral.Test.MockHttpClient()) { BaseAddress = new Uri(SDK.SandboxServerUrl) };
        sdk.Platform.Login(phoneNumber, "", password, true);

        var from = senderPhoneNumber;
        var to = recipientPhoneNumber;
        var text = "Test SMS message";
        var jsonData = "{\"to\": [{\"phoneNumber\": \"" + to + "\"}]," +
                       "\"from\": {\"phoneNumber\": \"" + from + "\"}," +
                      "\"text\": \"" + text + "\" }";
        Request request = new Request(SmsEndPoint, jsonData);
        ApiResponse result = sdk.Platform.Post(request);

        JToken token = JObject.Parse(result.Body);
        var messageStatus = (string)token.SelectToken("messageStatus");

Thanks,
Shashank.

from ringcentral-csharp-client.

tylerlong avatar tylerlong commented on June 5, 2024

I read your code and you are running sample code from unit tests. These are for mock testing only, not for real world usage.

Please read the doc for sample code: http://ringcentral-csharp.readthedocs.io/en/latest/

from ringcentral-csharp-client.

shashank0764 avatar shashank0764 commented on June 5, 2024

Hello ,

i used the new code now as mentioned in the above link still it breaks in the same place as the ring central dll is pointing to platform.cs

var sdk = new SDK(appKey, appSecret, SDK.SandboxServerUrl, "Application Name", "Application Version");

        // Password Grant Authorization
        var response = sdk.Platform.Login(phoneNumber, "", password, true);

        var jsonString = "{ \"text\":  \"hello sms!\", \"from\": { \"phoneNumber\": \"15188315172\" }, \"to\": [{ \"phoneNumber\": \"19295755445\" }] }";
        var request = new Request("/restapi/v1.0/account/~/extension/~/sms", jsonString);
        var response1 = sdk.Platform.Post(request);

from ringcentral-csharp-client.

shashank0764 avatar shashank0764 commented on June 5, 2024

Hello ,

once i commented the below code in the platform.cs inside the SDK then only it worked.
image

from ringcentral-csharp-client.

shashank0764 avatar shashank0764 commented on June 5, 2024

Hello Tyler,

Please let me know if commenting the above line is ok as this had apparently made the SMS work.
Can i close the issue?

Thanks,
Shashank.

from ringcentral-csharp-client.

tylerlong avatar tylerlong commented on June 5, 2024

Hi @shashank0764 ,

First of all, this is not the right place for your question. You are talking about https://github.com/ringcentral/ringcentral-csharp which is not the current repository.

Why do you need to change the source code of the SDK? How did you install it? The recommended way is to install it via NuGet. As shown in the readme file of https://github.com/ringcentral/ringcentral-csharp

Install-Package RingCentralSDK

Last but not least. could you please post the full stack trace of the exception? And from your first screenshot, there was a NullReferenceExcepotion, could you please tell me which object is null?

from ringcentral-csharp-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.